Designing IA for AI - Information Architecture Conference 2024
Mvc - Titanium
1. MVC
Application is divided into three core components: the
model, the view, and the controller
View: the interface the user sees and interacts with
Model: manipulate the data in the application
Controller: handles the input event from the user interface
2. Why MVC for Titanium?
Better organization
Code reuse
Don’t like messy files
3. How MVC in Titanium?
Framework Used:
Appcelerator on Rails
Ruby-based generator
Model generator creates standard code for accessing
data
Controller generator writes both View and Controller
code
Migration generator who generate SQL code for table
creation
5. To generate view and controller
Execute ruby script to generate view and
controller
>>ruby scripts/generate.rb controller Products
Above command generate following files:
-Resources/controllers/products.js
-Resources/views/products.js
6. Template generated by ruby
script for view
var ProductView = View.extend({
init: function(win, controller) {
this._super(win, controller);
this.layout();
},
layout: function() {
Write code to Create
button/ view/ text/ field ( all UIs)
}
});
7. Template generated by ruby
script for controller
var ProductController = Controller.extend({
init: function(win) {
this._super(win);
this.view = new ProductView(win,
this);
},
btnClicked: function(event) {
Write code for Action to perform
}
});
8. Instantiate controller
In app.js file:
//instantiate controller
var productController = new
ProductController(pass window);
// this pass window will return value which
//we could open
Open passed window;
9. What skills do we need?
Javascript
Titanium
Ruby (if we know ,that ll be plus point)