Appcelerator Titanium: Patterns and Best Practices
Formats:
save 15%!
save 37%!
Free Shipping!
| Also available on: |
|
- Full step-by-step approach to help structure your apps in an MVC style that will make them more maintainable, easier to code and more stable
- Learn best practices and optimizations both related directly to JavaScript and Titanium itself
- Learn solutions to create cross-compatible layouts that work across both Android and the iPhone
Book Details
Language : EnglishPaperback : 110 pages [ 235mm x 191mm ]
Release Date : February 2013
ISBN : 184969348X
ISBN 13 : 9781849693486
Author(s) : Boydlee Pollentine , Trevor Ward
Topics and Technologies : All Books, Mobile
Table of Contents
PrefaceChapter 1: Understanding JavaScript Patterns
Chapter 2: Titanium Best Practices
Chapter 3: Building an Application Using CommonJS and the MVC Pattern
Chapter 4: Cross-platform Design Methods
Chapter 5: Using JSONDB as an Alternative to SQLite
Index
- Chapter 1: Understanding JavaScript Patterns
- It's all object(ive)
- Understanding scope and the global object
- The global object
- Code structure and formatting
- Use semicolons and curly brackets
- eval is evil
- The curly bracket position
- Not all operators are created equal
- Formatting, commenting, and naming conventions
- Prototype
- Micro optimizations
- Declaring variables outside the for statements
- Using forEach instead of for loop
- Using shortcuts for simple if statements
- Summary
- Chapter 2: Titanium Best Practices
- CommonJS
- Code formatting
- Code validation
- Comment meaningfully
- Do not pollute the global object
- JavaScript instance
- CommonJS modules
- CommonJS best practices
- Managing memory
- Summary
- Chapter 3: Building an Application Using CommonJS and the MVC Pattern
- Standards
- Frameworks
- The architecture
- CommonJS
- The bootstrap
- Multilingual
- Directory structure
- Android
- iPhone and iPad
- Control
- Model
- Services
- Data
- UI
- Tools
- Naming
- The application
- The controller
- Tools (helpers)
- CommonJS require
- Callbacks
- Model
- UI
- The layout module
- The custom menu
- Common elements
- Windows
- The controller updated
- Fail gracefully
- Summary
- Chapter 4: Cross-platform Design Methods
- The difference between DPs and PXs
- Understanding Ti.UI.SIZE and Ti.UI.FILL
- Ti.UI.SIZE
- Ti.UI.FILL
- Choosing a cross-platform layout method
- Using Ti.Platform.osname statements
- Developing with separate UI files
- Importing component styles from external files
- Building a JavaScript stylesheet CommonJS module
- Using the Stylesheet CommonJS module in your app
- Extending the Stylesheet module for page-specific styles
- Summary
- Chapter 5: Using JSONDB as an Alternative to SQLite
- Installing the JSONDB module
- Setting up JSONDB
- Creating a JSONDB CommonJS module
- Using JSONDB queries
- Summary
Boydlee Pollentine
Trevor Ward
Code Downloads
Download the code and support files for this book.
Submit Errata
Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.
Errata
- 2 submitted: last submission 03 May 2013Errata type: Code | Page numbers: 47 and 60
The term removeAppNavListener should be removeEventListener.
Errata type: Code Page No: 36
The bootstrap
control.startTheApplication(); should be control.startApp()
Errata type: Code Page No: 55
The layout module
height : '51dp'
width : '100%'
background : '#000000' } };
should be
height : '51dp',
width : '100%',
background : '#000000' } };
Errata type: Code Page No: 55
The custom menu
var menuBarWin = Ti.UI.createView({
height : layout.params.menu.height,
width : layout.params.menu.width,
bottom : 0
});
should be
var menuBarWin = Ti.UI.createView({
height : layout.params.menu.height,
width : layout.params.menu.width,
backgroundColor: layout.params.menu.background;
bottom : 0
});
Errata type: Typo Page No: 56
memuButtonA.addEventListener('click', processButA); should read menuButtonA.addEventListener('click', processButA);
Errata type: Code Page No: 55
In loadMenuBar(inParam) add the line menuBarWin.add(menuButtonA);
Errata type: Code Page No: 56
line2. ')}' should read '})'
Errata type: Code Page No: 57
Line newWin.add(newWinDisplay) is missing in loadHomeWindow() to add the display to the window.
Errata type: Code Page No: 57
The lines:
// include the menu
var mainMenu = require('/ui/common/menu');
newWin.add(mainMenu);
needs to be changed to:
// include the menu
var mainMenu = require('/ui/common/menu');
mainMenuBar = mainMenu.loadMenuBar();
newWin.add(mainMenuBar);
Errata type: Code Page No: 59
Extra '}' at end of processBackButton(inParam) function so it should be:
function processBackButton(inParam) {
var iPos = ((backArray.length - 2) < 0) ? 0 : (backArray.length - 2);
if (iPos >= 0) {
...............
common.navHandler(tmpParams);
}
}
Errata type: Code Page No: 60
The function removeAppNavListener()
should be
Ti.App.removeEventListener('APPNAV', appNavigation);
Errata type: Code Page No: 60
Missing ';' at end of line addAppNavListener() in startApp() function
Note:The presence or absence of the semicolon won't make any difference to the code.
Sorry, there are currently no downloads available for this title.
- Make your apps easier to maintain and more memory efficient with CommonJS
- Understand JavaScript best practices and prototypal inheritance
- Learn to structure your app in an MVC style pattern with special consideration given to memory management, localization and app layout
- Understand and implement the new Appcelerator Cloud Services" needs to be completely removed
- Learn ways to generate and implement cross platform layouts
- Find alternatives to standard SQLite databases, including JSONDB
- Learn how to implement a series of Titanium API and JavaScript optimizations
- Get solutions to creating cross-compatible layouts that work across both Android and the iPhone
Titanium Mobile has quickly become the platform of choice for many mobile developers and is growing and changing at a rapid rate. From the implementation of CommonJS, MVC design patterns and more, the last year in Titanium development has been a rollercoaster of change for the better. With this knowledge at your disposal you’ll be creating top quality, highly capable and stable apps in no time.
This book shows you exactly how to implement all the latest Titanium Mobile best practices into your apps, from a thorough explanation of CommonJS with plenty of examples, through to structuring a complete MVC style codebase. With advanced topics such as implementing patterns and utilizing ACS, through to a thorough investigation of CommonJS and prototype, this book will take you from Titanium Novice to Titanium Ninja in no time!
"Appcelerator Titanium: Patterns and Best Practices" starts off with some explanations on JavaScript practices and advanced topics, before getting stuck into the new CommonJS pattern and using that to implement MVC-style architectures for your application. It continues in a practical, hands on manner, explaining how to perform cross device layouts with different techniques, and how to implement SQL alternatives such as JSONDB.
The book discusses some of the major advanced JavaScript topics, such as prototype and micro optimizations, before leading the developer into a thorough explanation of the CommonJS pattern, MVC implementation and advanced topics such as SQL alternatives and implementing designs for cross device layouts.
The book takes a step-by-step approach to help you understand CommonJS and Titanium architecture patterns, with easy to follow samples and plenty of in-depth explanations.
If you're an existing Titanium developer – or perhaps a new developer looking to start off your Titanium applications "the right way", then this book is for you. With easy to follow examples and a full step-by-step account of architecting a sample application using CommonJS and MVC, you'll be implementing enterprise grade Titanium solutions in no time.
You should have some JavaScript experience and familiarity with the Titanium development environment, along with a basic knowledge of the development lifecycle and packaging for Android and iOS devices.

