As a hybrid mobile software engineer, what most excites me about an application development technology is the extent to which it facilitates my day-to-day work of performing maintainability, scalability and code reuse application development tasks.
Three suggestions for avoiding maintainability and scalability nightmares
Dojox/app will allow your hybrid application to centralize functionality and configuration, to be more agile at development and to integrate with your data servers easily.
Dojox/app adopts the model view controller (MVC) paradigm and introduces the concepts of application controllers and modules as mechanisms of accessing and inheriting centralized functionality.
It decouples HTML from the JS functionality associated to it. This way you can define which template is being used by a view and which is the view controller associated to it.
It is in charge of distributing views in hierarchies.
It centralizes all the Dojo dependencies that your app uses in one single file.
It allows you to define which models and data stores should be used by your modules, and the controllers of your views.
It allows you to maintain a common path that will be resolved and shared across all of your implementation files.
You will be able to reuse multiple views templates and views controllers by the simple exercise of modifying paths in a centralized file.
All the information contained in it is accessible to views controllers and modules through one single object, this.app, after the application is loaded.
In order to be agile in mobile development a strategy for code inheritance and complex UI design should be imposed.
In dojox/app, a views controller inherits and accesses centralized functionality through the modules, the application controllers and the this.app object in the following manners:
Has access to this.myModuleFooFunction(bar), which is a function implemented in one of the modules listed in the configuration file
Has access to this.app, which keeps the configuration JSON object (for example, you would be able to access this.app.defaultView). It also keeps functionality defined by the application controllers listed on the configuration file (for example, if I include dojox/app/controllers/Transition I would be able to call this.app.emit(“app-transition”, target , data) from any view controller)
Inherits the functions from dojox/app/View, which contains a rendering mechanism so that you can handle the loading and deloading of your HTML templates (for example, beforeActivate, aferActivate, beforeDeactivate, afterDeactivate)
Allows you to extend dojox/app/View and add your own view definition logic so that it’s propagated throughout all of your view controllers
With dojox/app your team will be able to deliver the project’s honey just as bees do for their hive. They will have the mechanisms for delivering isolated code, which affects the application as a whole.
Complex designs are achieved in dojox/app by its layout controller mechanism. Basically we can distribute multiple HTML files that when loaded will be distributed according to a predefined layout. We will place the data-app-constraint attribute along our HTML code to let the layout controller know how to distribute HTML templates and elements.
Watch your server integration
The thing I most prefer about dojox/app is that it is fully integrated with dojox/mvc. It allows you to maintain fresh copies of your model data. You can access and manipulate such models from any controller and module. You can bind model changes to views and UI interactions to model data updates. This way, when a change happens on one end, with no additional line of code needed, such a change is reflected in the other end.
Finally, you can centralize all your server calls and application programming interfaces (API) into your modules. If you are using IBM Worklight adapter server integration, or simple Ajax requests such as WL.Client.invokeProcedure() or xhr.get(), which will need procedure and URL information, the parameters, success and error handlers can be maintained in one single file and not in multiples across your application.
If you can't wait to integrate your app with dojox/app, stay in touch and reach me for further questions at @MolinaMobile.