SlideShare una empresa de Scribd logo
1 de 97
Descargar para leer sin conexión
Developing maintainable
Cordova applications

Ivano Malavolta
DISIM | University of L’Aquila
Roadmap
•
•
•
•
•

Introduction

Backbone

I implemented all best practices and advices in this
presentation in a generic app template available here:

Require JS

Handlebars
Conclusions

https://github.com/iivanoo/cordovaboilerplate
Introduction
We are building apps, not web sites

If your code is not structured:

•

it is extremely easy that your web app becomes a
big mess of HTML + CSS + JavaScript

•

maintaining each part of your app asks for a
deep analysis of ALL its aspects (logic, presentation, etc.)

•

you may waste a whole day due to a missing <
What we want to avoid

Imagine yourself trying to change

•
•

how a movie should be rendered in your app
the REST API providing info about movies
Some technical advices from a real project...
Some technical advices from a real project...
Some technical advices from a real project...
Some technical advices from a real project...
Some technical advices from a real project...
How I structure my applications

MVC framework for
giving structure

File and module loader
for code modularization

Templating engine for
separation of concerns

Disclaimer
this is MY way to structure apps, you can follow yours
How I structure my applications
Backbone
•
•
•
•
•
•
•

Why Backbone

Events
Models

Collections
Views
Routers
Summary
Why Backbone
Backbone gives you STRUCTURE
Why Backbone
represent
data

From the Backbone website...

manipulate
the DOM

lists
of models
Why Backbone
Additionally, Backbone provides also features for:
sync
for managing how to persist models (default is via REST)
events
for managing how data and control are exchanged within your app
router
for managing the interaction flow among views
Who is using Backbone?
Backbone
•
•
•
•
•
•
•

Why Backbone

Events
Models

Collections
Views
Routers
Summary
Events
Any object communicates with other objects via events

It gives the object the ability to bind and trigger custom named events

It is extremely useful for exchanging data and control among objects
Events

Basically, each object can:

•
•

listen to events
trigger events
Events
Two types of events:

built-in

custom
you define your own types of event
Events API
object will react to the “alert” event
(the “off” function detaches the event)

the “alert” event is fired

event parameters
Events API
Events methods:
on

listenTo
object.on(event, callback, [context])

off

object.listenTo(other, event, callback)
stopListening

object.off([event], [callback], [context])
once

object.stopListening([other], [event], [callback])
listenToOnce

object.once(event, callback, [context])
trigger

object.trigger(event, [*args])

object.listenToOnce(other, event, callback)
Events summary
Backbone
•
•
•
•
•
•
•

Why Backbone

Events
Models

Collections
Views
Routers
Summary
Models

MVC: Notify their observers about
state using the Observer pattern

Models represent your data

Each model represents a data type in your app, together with the logic surrounding it, like:

•
•
•
•
•

persistence
conversions

validation
computed properties

access control
Models
You extend Backbone.Model with your domain-specific methods, and Model provides a basic set of
functionality for managing changes, like:

•
•
•
•

getter and setter
id

constructor
REST-based persistence
Example of model
custom method

an attribute

event fired when
“color” changes

custom method
invocation
Model constructore and attributes
initialize()
it is triggered every time you create a new instance of a model
it works also for collections and views
it can take a JS object for setting also attributes
get() & set()
they are used to set and retrieve the value of certain attributes
defaults

a property named 'defaults' in your model declaration
Example

http://goo.gl/UOahsP
Model persistence
Backbone.sync
is the function that Backbone calls every time it attempts to read or save a model

By default, it uses Ajax to make a REST-ish request to a server

Resources represented
as JSON strings
Sync signature
sync(method, model, [options])
method
the CRUD method ("create“, "read“, "update", or "delete")
model
the model (or collection) to be synced

example of overriden sync:
http://bit.ly/KWdxNN

options
success and error callbacks, and all other jQuery request options

Sync returns a jQuery XMLHttpRequest (jqXHR) object

It implements the Promise
interface
Sync usage
Normally you will not use the sync method directly, you will do it implicitly when you call one of these
methods

Model

•
•
•

fetch: gets the most up-to-date values of the model instance

save: persists the model instance
destroy: deletes the model instance

Collection

•
•

fetch: gets all the models of the collection from the server

create: creates a model, saves it to the server and adds it to the collection
Overriding sync
You can override it in order to use a different persistence strategy, such as:

•
•
•

WebSockets
Local Storage
WebSQL

Backbone.sync is the default global function that all models use unless the models have a sync method
specifically set
Models summary
Backbone
•
•
•
•
•
•
•

Why Backbone

Events
Models

Collections
Views
Routers
Summary
Collections

MVC: Notify their observers about
state using the Observer pattern
(same as models)

Collections are ordered sets of models

You can:

•
•
•
•

Any event that is triggered on a model in a collection will
also be triggered on the collection directly

bind change events to be notified when any model in the collection has been modified
listen for add and remove events
fetch the collection from the server (or other persistence layers)

find models or filter collections themeselves

The model attribute of a collection represents the kind of model that can be stored in it
Collection example

http://goo.gl/UOahsP
Collections summary
Backbone
•
•
•
•
•
•
•

Why Backbone

Events
Models

Collections
Views
Routers
Summary
Views
Views represent and manage the visible parts of your application

MVC: observe models, and update
itself according to the state of the
models + manage user inputs (it’s a
controller, to this sense)

They are also used to

•
•

listen to interaction events
and react accordingly

views can be rendered at any time, and inserted into the DOM

you get high-performance UI rendering
with as few reflows and repaints as possible
Interaction with the DOM
All views refer to a DOM element at all times, even if they are already in the page or not

this.el is a reference to the DOM element, it is created from:
tagName
for example body, ul, span, img
className

class name of some element within the DOM
id

id of an element within the DOM

If none of them is specified,
this.el is an empty <div>
Rendering the view
The render() method is used to update the this.el element with the new HTML

The default implementation of render() is a no-op
 you have to override it to update this.el with your HTML code

Backbone is agnostic with respect to your code in render(), however...

you are STRONGLY encouraged to use a
Javascript templating library here
View example

http://goo.gl/UOahsP
Interaction with the user
Events map
“event_name selector”: callback

Events callbacks
Views summary
Backbone
•
•
•
•
•
•
•

Why Backbone

Events
Models

Collections
Views
Routers
Summary
The router
Backbone.Router provides methods for routing client-side pages,
and connecting them to actions and events

At a minimum, a router is composed of two main parts:

routes
an hash that pairs routes to actions

actions
JS functions triggered when certain routes are navigated
Routing
Every router contains an hash that maps routes to functions on your router

URLs fragments can also contain dynamic data via Backbone-specific URL parts:
parameter (:param)
match a single URL component between slashes
splat (*fragment)
match any number of URL components
Routing
routes map

routing
functions
History
History serves as a global router to
1. handle hashchange events

Technically, it uses the HTML5 History
API to listen to to its job
For older browsers, it uses URL hash
fragments as fallback

2. match the appropriate route
3. trigger callbacks

You should never access it directly, you just need call Backbone.history.start() to begin
monitoring hashchange events, and dispatching routes in your app
Call Backbone.history.navigate(ROUTE_NAME, {trigger: true}); to activate a specific route
of the router
Router summary
Backbone
•
•
•
•
•
•
•

Why Backbone

Events
Models

Collections
Views
Routers
Summary
Classical workflow
1. You dig into JSON objects
2. Look up elements in the DOM
3. Update the HTML by hand
Backbone-based workflow
•

You organize your interface into logical views backed by models

•

Each view can be updated independently when the model changes,
without having to redraw the page
You can bind your view‘s render()
function to the model‘s "change”
event
 now everywhere that model
data is displayed in the UI, it is
always immediately up to date
Is Backbone real MVC?
Let’s look at the description of the Model-View-Presenter pattern on Wikipedia:
Model
an interface defining the data to be displayed or otherwise acted upon in the user interface
View
passive interface that displays data (the model) and routes user commands (events) to the
presenter to act upon that data
Presenter
acts upon the model and the view. It retrieves data from repositories (the model), and formats it
for display in the view
Roadmap
•
•
•
•
•

Introduction

Backbone
Require JS

Handlebars
Conclusions
Require JS
•
•
•
•

Why Require JS

Using modules
Defining modules

Configuring Require JS
Why Require JS
We are building apps, not website

We need well-specified and isolated JS files/modules

Code complexity grows as the app gets bigger
 we need some sort of #include/import/require
 ability to load nested dependencies
What we want to avoid
uncontrolled scripts

poor control flow understanding
Require JS
JavaScript and module loader
RequireJS is a JavaScript file file and module loader
Using a modular script loader like Require JS will improve the modularity of your code
 speed in implementing changes
 better undestanding of the code

Require JS allows modules to be loaded as fast as possible, even out of order, but evaluated in the
correct dependency order

Built on the Module Pattern
The module pattern
A JavaScript code module is some JavaScript code located in a registered location (e.g., a function)

All of the code that runs inside the function lives in a closure, which provides
•

privacy

•

state

throughout the lifetime of the module
Module example
Technically, it is simply a function that executes immediately
Module VS script files

VS

A module is different from a traditional script file in that it defines a well-scoped object that avoids
polluting the global namespace  its retained objects can be deleted by the GC
It can explicitly list its dependencies and get a handle on those dependencies without needing to refer to
global objects, but instead receive the dependencies as arguments to the function that defines the
module
Require JS
•
•
•
•

Why Require JS

Using modules
Defining modules

Configuring Require JS
Using modules
The main HTML:

main.js is the entry point of the app
Using modules
Required modules
The main JS file:

This function is called when all dependencies are loaded

If a required module calls define(), then this function is not fired
until its dependencies have been loaded

References to
required modules
Require JS
•
•
•
•

Why Require JS

Using modules
Defining modules

Configuring Require JS
Module without dependencies

Always one module per files

the simplest module can be a plain
collection of name/value pairs
module with initialization

Setup code

Public variables

The returned element can be any valid JS element
By convention I always return an object representing the module
Module with dependencies
Dependent module reference

Dependency
definition

This function is called when
zepto.js is loaded.
If zepto.js calls define(), then
this function is not fired until
also zepto’s dependencies
have loaded

Dependent module usage
Require JS under the hoods...
1. loads each dependency as a script tag, using head.appendChild() and waits for all dependencies to
load
2. computes the right order in which to call the functions that define the modules
3. calls the module definition functions of each dependency in the right order
1

4

3
jQuery

Backbone

MovieModel

5
MoviesCollection
2

7

SpinJS

main.js

6

MoviesView
Require JS
•
•
•
•

Why Require JS

Using modules
Defining modules

Configuring Require JS
Configuring Require JS
Require refers to a global configuration options

It allows developers to:

•
•
•
•

set the paths to all used frameworks in one place
use older frameworks as modules (shim)
define configuration params for the modules
etc.
Configuring Require JS
paths to used frameworks

Shims for older
frameworks

Dependent module usage
Roadmap
•
•
•
•
•

Introduction

Backbone
Require JS

Handlebars
Conclusions
Handlebars
•

Why Handlebars

•

Handlebars basics

•

Usage with Backbone and Require JS
Why Handlebars
separate logic from from logic
We want to separate presentationpresentation
TRANSLATE TO: we don’t want to put any HTML element into JavaScript code

Imagine yourself trying to change how a movie should be rendered in
your app...
Handlebars
•

Why Handlebars

•

Handlebars basics

•

Usage with Backbone and Require JS
Example of template

A handlebars expression is

{{ something }}
Escape values

Handlebars HTML-escapes all the values returned by an {{expression}}
If you don't want Handlebars to escape a value, use the "triple-stash“  {{{ expression }}}
Populate your template
The recurrent process of obtaining a populated template is the following:
1. create the template T with its placeholders {{ - }}
2. compile the template into a JavaScript function t
3. create a context CT containing the actual values for placeholders

4. run the compiled template t(CT) to obtain the final HTML fragment
1. create the template
Templates are defined within a <script> tag or in external files
2. compile the template
Handlebars.compile is used to compile a template

Compiling = obtaining a JS object representing the template
3. create a context for the template
A context is a Javascript object used to populate a template

Here the keys of the object must match with the name of the placeholder to be populated
4. obtain the final HTML fragment
You have to execute a template with a context in order to get its corresponding HTML code
Expressions
The simplest expression is a simple identifier

This expression means "look up the username property in the current context"
Expressions with paths
Handlebars expressions can also be dot-separated paths

This expression means
"look up the user property in the current context,
then look up the username property in the result"
Helpers
Helpers are Javascript functions that return HTML code

You should return a Handlebars SafeString if you don't want it to be escaped by default
Calling helpers
A Handlebars helper call is a simple identifier, followed by zero or more parameters
Each parameter is a Handlebars expression
es.

{{ test user }}
In this case, test is the name of the Handlebars helper, and user is a parameter to the helper
Built-in helpers
with
It shifts the context for a section of a template
{ title: "My first post!",
author: { firstName: “Ivano", lastName: “Malavolta" }
}

<div class="entry“>
<h1>{{title}}</h1>
{{#with author}}
<h2>By {{firstName}} {{lastName}}</h2>
{{/with}}
</div>

<div class="entry“>
<h1>My first post!</h1>
<h2>By Ivano Malavolta</h2>
</div>
Built-in helpers

Inside the block, you can use
this
to reference the element being iterated

each
To iterate over a list

{ people: [ “Ivano", “Andrea", “Paolo" ] }

<ul class="people_list">
{{#each people}}
<li>{{this}}</li>
{{/each}}
</ul>

<ul class="people_list">
<li>Ivano</li>
<li>Andrea</li>
<li>Paolo</li>
</ul>
Built-in helpers

The unless helper is the inverse of if

If / Else
It renders the block if its argument is not equal to false, undefined, null, []
{ title: "My first post!",
author: undefined }
}
<div class="entry“>
<h1>{{title}}</h1>
{{#if author}}
<h2>By {{firstName}} {{lastName}}</h2>
{{#else}}
<h2>Unknown author</h1>
{{/if}}

<div class="entry“>
<h1>My first post!</h1>
<h2>Unknown author</h2>
</div>
handlebars summary
Each Template can contain Expressions and Helpers operating on them
The main helpers are:
• with
• each
• if / else /unless
You can define your own Helpers that operate on expressions, they return HTML code

A template can be (pre)-compiled and must be executed with a context in order to return the
final HTML fragment
Handlebars
•

Why Handlebars

•

Handlebars basics

•

Usage with Backbone and Require JS
Usage with Backbone and Require JS
Templates can be seen as special modules

So we can have the following:
• a separate HTML file for each template
• a Backbone view can have a dependency to each template
• the template can be executed by using a JSON object of the Backbone model as context
Example

Dependency to template HTML file

It contains a string

Compiled template

Execution of the template
References

http://backbonejs.org
http://requirejs.org
http://handlebarsjs.com
https://github.com/iivanoo/cordovaboilerplate
Contact

Ivano Malavolta | DISIM
+ 39 380 70 21 600

iivanoo
ivano.malavolta@univaq.it
www.ivanomalavolta.com

Más contenido relacionado

La actualidad más candente

MWLUG - Universal Java
MWLUG  -  Universal JavaMWLUG  -  Universal Java
MWLUG - Universal JavaPhilippe Riand
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by GoogleASG
 
IBM Digital Experience Theme Customization
IBM Digital Experience Theme CustomizationIBM Digital Experience Theme Customization
IBM Digital Experience Theme CustomizationVan Staub, MBA
 
OSCON Titanium Tutorial
OSCON Titanium TutorialOSCON Titanium Tutorial
OSCON Titanium TutorialKevin Whinnery
 
Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Henry Van Styn
 
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerPaul Jones
 
RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014Henry Van Styn
 
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)Tech OneStop
 
Cross-Platform Mobile Chemistry Apps
Cross-Platform Mobile Chemistry AppsCross-Platform Mobile Chemistry Apps
Cross-Platform Mobile Chemistry AppsRichard Apodaca
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...seleniumconf
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )senthil0809
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UITech OneStop
 
XPages: The Next Step In Your Life As A Notes Developer
XPages: The Next Step In Your Life As A Notes DeveloperXPages: The Next Step In Your Life As A Notes Developer
XPages: The Next Step In Your Life As A Notes DeveloperPeter Presnell
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
DanNotes XPages Mobile Controls
DanNotes XPages Mobile ControlsDanNotes XPages Mobile Controls
DanNotes XPages Mobile ControlsPaul Withers
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overviewSergey Seletsky
 

La actualidad más candente (20)

MWLUG - Universal Java
MWLUG  -  Universal JavaMWLUG  -  Universal Java
MWLUG - Universal Java
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
IBM Digital Experience Theme Customization
IBM Digital Experience Theme CustomizationIBM Digital Experience Theme Customization
IBM Digital Experience Theme Customization
 
C#/.NET Little Wonders
C#/.NET Little WondersC#/.NET Little Wonders
C#/.NET Little Wonders
 
OSCON Titanium Tutorial
OSCON Titanium TutorialOSCON Titanium Tutorial
OSCON Titanium Tutorial
 
Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017
 
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
 
RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014
 
Aem best practices
Aem best practicesAem best practices
Aem best practices
 
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
 
Cross-Platform Mobile Chemistry Apps
Cross-Platform Mobile Chemistry AppsCross-Platform Mobile Chemistry Apps
Cross-Platform Mobile Chemistry Apps
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
 
Wwf
WwfWwf
Wwf
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
 
XPages: The Next Step In Your Life As A Notes Developer
XPages: The Next Step In Your Life As A Notes DeveloperXPages: The Next Step In Your Life As A Notes Developer
XPages: The Next Step In Your Life As A Notes Developer
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
DanNotes XPages Mobile Controls
DanNotes XPages Mobile ControlsDanNotes XPages Mobile Controls
DanNotes XPages Mobile Controls
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
 
Atlas Php
Atlas PhpAtlas Php
Atlas Php
 

Destacado

Competency Series Values Workshop Chandramowly
Competency Series   Values Workshop  ChandramowlyCompetency Series   Values Workshop  Chandramowly
Competency Series Values Workshop ChandramowlyChandramowly :
 
2012 10-16 gettingpublishedslideshare
2012 10-16 gettingpublishedslideshare2012 10-16 gettingpublishedslideshare
2012 10-16 gettingpublishedslidesharekathwoolf
 
Values workshop - slideshare
Values workshop  - slideshareValues workshop  - slideshare
Values workshop - slideshareKate O'Reilly
 
Pitch method : SIMAC or persuasive selling format
Pitch method : SIMAC or persuasive selling formatPitch method : SIMAC or persuasive selling format
Pitch method : SIMAC or persuasive selling formatEloquens
 
High Performance PhoneGap Apps
High Performance PhoneGap AppsHigh Performance PhoneGap Apps
High Performance PhoneGap AppsSyd Lawrence
 
Phonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationPhonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationMuhammad Hakim A
 
[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JSIvano Malavolta
 
모바일 앱 개발을 위한 Agile 적용
모바일 앱 개발을 위한 Agile 적용모바일 앱 개발을 위한 Agile 적용
모바일 앱 개발을 위한 Agile 적용Kevin Kim
 
Swift server-side-let swift2016
Swift server-side-let swift2016Swift server-side-let swift2016
Swift server-side-let swift2016Eric Ahn
 
하이브리드앱 아키텍쳐 및 개발 사례
하이브리드앱 아키텍쳐 및 개발 사례하이브리드앱 아키텍쳐 및 개발 사례
하이브리드앱 아키텍쳐 및 개발 사례동수 장
 
Designing Culture Workshop
Designing Culture WorkshopDesigning Culture Workshop
Designing Culture WorkshopTeresa Brazen
 

Destacado (13)

PhoneGap/Cordova
PhoneGap/CordovaPhoneGap/Cordova
PhoneGap/Cordova
 
Competency Series Values Workshop Chandramowly
Competency Series   Values Workshop  ChandramowlyCompetency Series   Values Workshop  Chandramowly
Competency Series Values Workshop Chandramowly
 
Values Creation Workshop (VCW) by LERIO Consulting
Values Creation Workshop (VCW) by LERIO ConsultingValues Creation Workshop (VCW) by LERIO Consulting
Values Creation Workshop (VCW) by LERIO Consulting
 
2012 10-16 gettingpublishedslideshare
2012 10-16 gettingpublishedslideshare2012 10-16 gettingpublishedslideshare
2012 10-16 gettingpublishedslideshare
 
Values workshop - slideshare
Values workshop  - slideshareValues workshop  - slideshare
Values workshop - slideshare
 
Pitch method : SIMAC or persuasive selling format
Pitch method : SIMAC or persuasive selling formatPitch method : SIMAC or persuasive selling format
Pitch method : SIMAC or persuasive selling format
 
High Performance PhoneGap Apps
High Performance PhoneGap AppsHigh Performance PhoneGap Apps
High Performance PhoneGap Apps
 
Phonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationPhonegap/Cordova vs Native Application
Phonegap/Cordova vs Native Application
 
[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS
 
모바일 앱 개발을 위한 Agile 적용
모바일 앱 개발을 위한 Agile 적용모바일 앱 개발을 위한 Agile 적용
모바일 앱 개발을 위한 Agile 적용
 
Swift server-side-let swift2016
Swift server-side-let swift2016Swift server-side-let swift2016
Swift server-side-let swift2016
 
하이브리드앱 아키텍쳐 및 개발 사례
하이브리드앱 아키텍쳐 및 개발 사례하이브리드앱 아키텍쳐 및 개발 사례
하이브리드앱 아키텍쳐 및 개발 사례
 
Designing Culture Workshop
Designing Culture WorkshopDesigning Culture Workshop
Designing Culture Workshop
 

Similar a Developing maintainable Cordova applications

Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile appsIvano Malavolta
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!Roberto Messora
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular jsAayush Shrestha
 
Knockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockoutKnockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockoutAndoni Arroyo
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh! Chalermpon Areepong
 
Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.jsBert Wijnants
 
Raybiztech Guide To Backbone Javascript Library
Raybiztech Guide To Backbone Javascript LibraryRaybiztech Guide To Backbone Javascript Library
Raybiztech Guide To Backbone Javascript Libraryray biztech
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - IntroductionSenthil Kumar
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCAnton Krasnoshchok
 
Backbone/Marionette introduction
Backbone/Marionette introductionBackbone/Marionette introduction
Backbone/Marionette introductionmatt-briggs
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014Ran Wahle
 

Similar a Developing maintainable Cordova applications (20)

Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile apps
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Knockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockoutKnockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockout
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
 
Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.js
 
Raybiztech Guide To Backbone Javascript Library
Raybiztech Guide To Backbone Javascript LibraryRaybiztech Guide To Backbone Javascript Library
Raybiztech Guide To Backbone Javascript Library
 
Intro lift
Intro liftIntro lift
Intro lift
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - Introduction
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
 
Backbone/Marionette introduction
Backbone/Marionette introductionBackbone/Marionette introduction
Backbone/Marionette introduction
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Angular 9
Angular 9 Angular 9
Angular 9
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 

Más de Ivano Malavolta

Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...Ivano Malavolta
 
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)Ivano Malavolta
 
Software sustainability and Green IT
Software sustainability and Green ITSoftware sustainability and Green IT
Software sustainability and Green ITIvano Malavolta
 
Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...Ivano Malavolta
 
How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]Ivano Malavolta
 
Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Ivano Malavolta
 
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Ivano Malavolta
 
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Ivano Malavolta
 
Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Ivano Malavolta
 
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Ivano Malavolta
 
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Ivano Malavolta
 
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Ivano Malavolta
 
Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Ivano Malavolta
 
[2017/2018] Agile development
[2017/2018] Agile development[2017/2018] Agile development
[2017/2018] Agile developmentIvano Malavolta
 
Reconstructing microservice-based architectures
Reconstructing microservice-based architecturesReconstructing microservice-based architectures
Reconstructing microservice-based architecturesIvano Malavolta
 
[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design LanguageIvano Malavolta
 
[2017/2018] Architectural languages
[2017/2018] Architectural languages[2017/2018] Architectural languages
[2017/2018] Architectural languagesIvano Malavolta
 
[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software ArchitectureIvano Malavolta
 
[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineeringIvano Malavolta
 

Más de Ivano Malavolta (20)

Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
 
The H2020 experience
The H2020 experienceThe H2020 experience
The H2020 experience
 
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)
 
Software sustainability and Green IT
Software sustainability and Green ITSoftware sustainability and Green IT
Software sustainability and Green IT
 
Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...
 
How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]
 
Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...
 
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
 
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
 
Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...
 
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
 
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
 
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
 
Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...
 
[2017/2018] Agile development
[2017/2018] Agile development[2017/2018] Agile development
[2017/2018] Agile development
 
Reconstructing microservice-based architectures
Reconstructing microservice-based architecturesReconstructing microservice-based architectures
Reconstructing microservice-based architectures
 
[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language
 
[2017/2018] Architectural languages
[2017/2018] Architectural languages[2017/2018] Architectural languages
[2017/2018] Architectural languages
 
[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture
 
[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering
 

Último

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Developing maintainable Cordova applications

  • 1. Developing maintainable Cordova applications Ivano Malavolta DISIM | University of L’Aquila
  • 2. Roadmap • • • • • Introduction Backbone I implemented all best practices and advices in this presentation in a generic app template available here: Require JS Handlebars Conclusions https://github.com/iivanoo/cordovaboilerplate
  • 3. Introduction We are building apps, not web sites If your code is not structured: • it is extremely easy that your web app becomes a big mess of HTML + CSS + JavaScript • maintaining each part of your app asks for a deep analysis of ALL its aspects (logic, presentation, etc.) • you may waste a whole day due to a missing <
  • 4. What we want to avoid Imagine yourself trying to change • • how a movie should be rendered in your app the REST API providing info about movies
  • 5. Some technical advices from a real project...
  • 6. Some technical advices from a real project...
  • 7. Some technical advices from a real project...
  • 8. Some technical advices from a real project...
  • 9. Some technical advices from a real project...
  • 10. How I structure my applications MVC framework for giving structure File and module loader for code modularization Templating engine for separation of concerns Disclaimer this is MY way to structure apps, you can follow yours
  • 11. How I structure my applications
  • 14. Why Backbone represent data From the Backbone website... manipulate the DOM lists of models
  • 15. Why Backbone Additionally, Backbone provides also features for: sync for managing how to persist models (default is via REST) events for managing how data and control are exchanged within your app router for managing the interaction flow among views
  • 16. Who is using Backbone?
  • 18. Events Any object communicates with other objects via events It gives the object the ability to bind and trigger custom named events It is extremely useful for exchanging data and control among objects
  • 19. Events Basically, each object can: • • listen to events trigger events
  • 20. Events Two types of events: built-in custom you define your own types of event
  • 21. Events API object will react to the “alert” event (the “off” function detaches the event) the “alert” event is fired event parameters
  • 22. Events API Events methods: on listenTo object.on(event, callback, [context]) off object.listenTo(other, event, callback) stopListening object.off([event], [callback], [context]) once object.stopListening([other], [event], [callback]) listenToOnce object.once(event, callback, [context]) trigger object.trigger(event, [*args]) object.listenToOnce(other, event, callback)
  • 25. Models MVC: Notify their observers about state using the Observer pattern Models represent your data Each model represents a data type in your app, together with the logic surrounding it, like: • • • • • persistence conversions validation computed properties access control
  • 26. Models You extend Backbone.Model with your domain-specific methods, and Model provides a basic set of functionality for managing changes, like: • • • • getter and setter id constructor REST-based persistence
  • 27. Example of model custom method an attribute event fired when “color” changes custom method invocation
  • 28. Model constructore and attributes initialize() it is triggered every time you create a new instance of a model it works also for collections and views it can take a JS object for setting also attributes get() & set() they are used to set and retrieve the value of certain attributes defaults a property named 'defaults' in your model declaration
  • 30. Model persistence Backbone.sync is the function that Backbone calls every time it attempts to read or save a model By default, it uses Ajax to make a REST-ish request to a server Resources represented as JSON strings
  • 31. Sync signature sync(method, model, [options]) method the CRUD method ("create“, "read“, "update", or "delete") model the model (or collection) to be synced example of overriden sync: http://bit.ly/KWdxNN options success and error callbacks, and all other jQuery request options Sync returns a jQuery XMLHttpRequest (jqXHR) object It implements the Promise interface
  • 32. Sync usage Normally you will not use the sync method directly, you will do it implicitly when you call one of these methods Model • • • fetch: gets the most up-to-date values of the model instance save: persists the model instance destroy: deletes the model instance Collection • • fetch: gets all the models of the collection from the server create: creates a model, saves it to the server and adds it to the collection
  • 33. Overriding sync You can override it in order to use a different persistence strategy, such as: • • • WebSockets Local Storage WebSQL Backbone.sync is the default global function that all models use unless the models have a sync method specifically set
  • 36. Collections MVC: Notify their observers about state using the Observer pattern (same as models) Collections are ordered sets of models You can: • • • • Any event that is triggered on a model in a collection will also be triggered on the collection directly bind change events to be notified when any model in the collection has been modified listen for add and remove events fetch the collection from the server (or other persistence layers) find models or filter collections themeselves The model attribute of a collection represents the kind of model that can be stored in it
  • 40. Views Views represent and manage the visible parts of your application MVC: observe models, and update itself according to the state of the models + manage user inputs (it’s a controller, to this sense) They are also used to • • listen to interaction events and react accordingly views can be rendered at any time, and inserted into the DOM you get high-performance UI rendering with as few reflows and repaints as possible
  • 41. Interaction with the DOM All views refer to a DOM element at all times, even if they are already in the page or not this.el is a reference to the DOM element, it is created from: tagName for example body, ul, span, img className class name of some element within the DOM id id of an element within the DOM If none of them is specified, this.el is an empty <div>
  • 42. Rendering the view The render() method is used to update the this.el element with the new HTML The default implementation of render() is a no-op  you have to override it to update this.el with your HTML code Backbone is agnostic with respect to your code in render(), however... you are STRONGLY encouraged to use a Javascript templating library here
  • 44. Interaction with the user Events map “event_name selector”: callback Events callbacks
  • 47. The router Backbone.Router provides methods for routing client-side pages, and connecting them to actions and events At a minimum, a router is composed of two main parts: routes an hash that pairs routes to actions actions JS functions triggered when certain routes are navigated
  • 48. Routing Every router contains an hash that maps routes to functions on your router URLs fragments can also contain dynamic data via Backbone-specific URL parts: parameter (:param) match a single URL component between slashes splat (*fragment) match any number of URL components
  • 50. History History serves as a global router to 1. handle hashchange events Technically, it uses the HTML5 History API to listen to to its job For older browsers, it uses URL hash fragments as fallback 2. match the appropriate route 3. trigger callbacks You should never access it directly, you just need call Backbone.history.start() to begin monitoring hashchange events, and dispatching routes in your app Call Backbone.history.navigate(ROUTE_NAME, {trigger: true}); to activate a specific route of the router
  • 53. Classical workflow 1. You dig into JSON objects 2. Look up elements in the DOM 3. Update the HTML by hand
  • 54. Backbone-based workflow • You organize your interface into logical views backed by models • Each view can be updated independently when the model changes, without having to redraw the page You can bind your view‘s render() function to the model‘s "change” event  now everywhere that model data is displayed in the UI, it is always immediately up to date
  • 55. Is Backbone real MVC? Let’s look at the description of the Model-View-Presenter pattern on Wikipedia: Model an interface defining the data to be displayed or otherwise acted upon in the user interface View passive interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data Presenter acts upon the model and the view. It retrieves data from repositories (the model), and formats it for display in the view
  • 57. Require JS • • • • Why Require JS Using modules Defining modules Configuring Require JS
  • 58. Why Require JS We are building apps, not website We need well-specified and isolated JS files/modules Code complexity grows as the app gets bigger  we need some sort of #include/import/require  ability to load nested dependencies
  • 59. What we want to avoid uncontrolled scripts poor control flow understanding
  • 60. Require JS JavaScript and module loader RequireJS is a JavaScript file file and module loader Using a modular script loader like Require JS will improve the modularity of your code  speed in implementing changes  better undestanding of the code Require JS allows modules to be loaded as fast as possible, even out of order, but evaluated in the correct dependency order Built on the Module Pattern
  • 61. The module pattern A JavaScript code module is some JavaScript code located in a registered location (e.g., a function) All of the code that runs inside the function lives in a closure, which provides • privacy • state throughout the lifetime of the module
  • 62. Module example Technically, it is simply a function that executes immediately
  • 63. Module VS script files VS A module is different from a traditional script file in that it defines a well-scoped object that avoids polluting the global namespace  its retained objects can be deleted by the GC It can explicitly list its dependencies and get a handle on those dependencies without needing to refer to global objects, but instead receive the dependencies as arguments to the function that defines the module
  • 64. Require JS • • • • Why Require JS Using modules Defining modules Configuring Require JS
  • 65. Using modules The main HTML: main.js is the entry point of the app
  • 66. Using modules Required modules The main JS file: This function is called when all dependencies are loaded If a required module calls define(), then this function is not fired until its dependencies have been loaded References to required modules
  • 67. Require JS • • • • Why Require JS Using modules Defining modules Configuring Require JS
  • 68. Module without dependencies Always one module per files the simplest module can be a plain collection of name/value pairs module with initialization Setup code Public variables The returned element can be any valid JS element By convention I always return an object representing the module
  • 69. Module with dependencies Dependent module reference Dependency definition This function is called when zepto.js is loaded. If zepto.js calls define(), then this function is not fired until also zepto’s dependencies have loaded Dependent module usage
  • 70. Require JS under the hoods... 1. loads each dependency as a script tag, using head.appendChild() and waits for all dependencies to load 2. computes the right order in which to call the functions that define the modules 3. calls the module definition functions of each dependency in the right order 1 4 3 jQuery Backbone MovieModel 5 MoviesCollection 2 7 SpinJS main.js 6 MoviesView
  • 71. Require JS • • • • Why Require JS Using modules Defining modules Configuring Require JS
  • 72. Configuring Require JS Require refers to a global configuration options It allows developers to: • • • • set the paths to all used frameworks in one place use older frameworks as modules (shim) define configuration params for the modules etc.
  • 73. Configuring Require JS paths to used frameworks Shims for older frameworks Dependent module usage
  • 76. Why Handlebars separate logic from from logic We want to separate presentationpresentation TRANSLATE TO: we don’t want to put any HTML element into JavaScript code Imagine yourself trying to change how a movie should be rendered in your app...
  • 78. Example of template A handlebars expression is {{ something }}
  • 79. Escape values Handlebars HTML-escapes all the values returned by an {{expression}} If you don't want Handlebars to escape a value, use the "triple-stash“  {{{ expression }}}
  • 80. Populate your template The recurrent process of obtaining a populated template is the following: 1. create the template T with its placeholders {{ - }} 2. compile the template into a JavaScript function t 3. create a context CT containing the actual values for placeholders 4. run the compiled template t(CT) to obtain the final HTML fragment
  • 81. 1. create the template Templates are defined within a <script> tag or in external files
  • 82. 2. compile the template Handlebars.compile is used to compile a template Compiling = obtaining a JS object representing the template
  • 83. 3. create a context for the template A context is a Javascript object used to populate a template Here the keys of the object must match with the name of the placeholder to be populated
  • 84. 4. obtain the final HTML fragment You have to execute a template with a context in order to get its corresponding HTML code
  • 85. Expressions The simplest expression is a simple identifier This expression means "look up the username property in the current context"
  • 86. Expressions with paths Handlebars expressions can also be dot-separated paths This expression means "look up the user property in the current context, then look up the username property in the result"
  • 87. Helpers Helpers are Javascript functions that return HTML code You should return a Handlebars SafeString if you don't want it to be escaped by default
  • 88. Calling helpers A Handlebars helper call is a simple identifier, followed by zero or more parameters Each parameter is a Handlebars expression es. {{ test user }} In this case, test is the name of the Handlebars helper, and user is a parameter to the helper
  • 89. Built-in helpers with It shifts the context for a section of a template { title: "My first post!", author: { firstName: “Ivano", lastName: “Malavolta" } } <div class="entry“> <h1>{{title}}</h1> {{#with author}} <h2>By {{firstName}} {{lastName}}</h2> {{/with}} </div> <div class="entry“> <h1>My first post!</h1> <h2>By Ivano Malavolta</h2> </div>
  • 90. Built-in helpers Inside the block, you can use this to reference the element being iterated each To iterate over a list { people: [ “Ivano", “Andrea", “Paolo" ] } <ul class="people_list"> {{#each people}} <li>{{this}}</li> {{/each}} </ul> <ul class="people_list"> <li>Ivano</li> <li>Andrea</li> <li>Paolo</li> </ul>
  • 91. Built-in helpers The unless helper is the inverse of if If / Else It renders the block if its argument is not equal to false, undefined, null, [] { title: "My first post!", author: undefined } } <div class="entry“> <h1>{{title}}</h1> {{#if author}} <h2>By {{firstName}} {{lastName}}</h2> {{#else}} <h2>Unknown author</h1> {{/if}} <div class="entry“> <h1>My first post!</h1> <h2>Unknown author</h2> </div>
  • 92. handlebars summary Each Template can contain Expressions and Helpers operating on them The main helpers are: • with • each • if / else /unless You can define your own Helpers that operate on expressions, they return HTML code A template can be (pre)-compiled and must be executed with a context in order to return the final HTML fragment
  • 94. Usage with Backbone and Require JS Templates can be seen as special modules So we can have the following: • a separate HTML file for each template • a Backbone view can have a dependency to each template • the template can be executed by using a JSON object of the Backbone model as context
  • 95. Example Dependency to template HTML file It contains a string Compiled template Execution of the template
  • 97. Contact Ivano Malavolta | DISIM + 39 380 70 21 600 iivanoo ivano.malavolta@univaq.it www.ivanomalavolta.com