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, Cloud Services, 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 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, how to implement SQL alternatives such as JSONDB, and how to get the best out of the new Appcelerator Cloud Services.
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. It completes with a full overview of the new Appcelerator Cloud Services and how to implement them in your own Titanium Mobile applications.
Approach
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.
Who this book is for
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, along with chapters on new features such as ACS, 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.
This book targets developers who are already familiar with the Titanium Mobile API and JavaScript programming. Topics covered span JavaScript programming practices to application architecture. Each area is discussed at a fairly high level, which makes for an easy read. The authors do a nice job of offering suggestions that can help developers create well structured applications. Specific chapters are:
1. Understanding JavaScript Patterns 2. Titanium Best Practices 3. Building and Application Using CommonJS and the MVC Pattern, 4. Cross Platform Design Methods 5. Using JSONDB as an Alternative to SQLite
JavaScript variable scope is different from that of most of the strongly typed languages. Add CommonJS into the mix and you have even more scope considerations. The first two chapters navigate the developer through object scope, show how to avoid “gotyas” associated with something as simple as placement of a curly brace, and show in general how to write clean JavaScript in CommonJS modules. The authors also take you into the Titanium Studio environment and show how to enable strict JavaScript validation using JSLint.
The third chapter provides a nice overview of how to structure an application using CommonJS with an MVC pattern. Changing from namespace applications to CommonJS can be difficult to get your arms around. Pollentine and Ward do a nice job of laying out specific examples for organizing the different application components, for bootstrapping an MVC application, and for managing interactions across components. This includes examples of using callback functions, which is a key technique for developing Titanium Mobile applications.
Chapter 4 is more than just cross platform considerations. The authors start by reinforcing some of the changes in component sizing introduced in Titanium 2.0. They also discuss in general how to implement common styling across an entire application. Then they show methods for overlaying platform specific styling as needed.
The last chapter is an introduction to using JSONDB for persistent data. It’s presented very nicely within the context of implementing a news reader application. The authors demonstrate all the standard CRUD operations.
Overall, I would say this book does a nice job of filling the void between having learned the Titanium Mobile API, and knowing how to structure a production quality application. I like the way the author’s present their best practices as recommendations, rather than “THIS is how you MUST do it.” I’d recommend this book for any Titanium Mobile developer.