Titanium Alloy: MVC architechture
Introduction
The Alloy framework of Titanium helps us to organize our applications into Model, View and Controller. It also provides the built-in support for Backbonejs and Underscorejs- JavaScript Library.
In this framework, the Model contains the data source, View(js) and style(tss) contains the UI part and Controller contains the business logic part of the application.
So, based on the above explanation, we can define the MVC architecture as follows:
- Controller
- It contains all the business logic part of the application.
- It can send command to the model to perform the CRUD (Create, Read, Update and Delete) operations.
- It can also send command to its associated views to change the views' presentation of the model(example lazy loading of listview, scrollview and tableview etc.).
- It is defined in the JS file inside the controller folder of the alloy framework.
- Model
- It represents the data source of the application. It can be any of the following:
- Data from web services
- Data from SQL
- Data from Local Storage
- Data from App properties
- It notifies its associated views to produce updated output sync with the data source.
- It also notifies the controllers to change the available set of commands.
- It is defined in JS file inside the model folder of the alloy framework.
- View
- A view requests information from the model via controller that it uses to generate an output being represented to the user.
- It is defined using XML and TSS files in views folder of the alloy framework.

Comments
Post a Comment