Thursday, March 21, 2013

Mobile Development Options - Part 4: Titanium Appcelerator & Titanium Studio

by Mark Giglione

Mobile Development Options - Part 4: Titanium Appcelerator & Titanium Studio

The Titanium SDK from Appcelerator is open source (with optional “for pay” support plans available) and basically works by cross compiling Javascript & HTML to native mobile code (iOS XCode, Android & others).  In January 2011, Appcelerator acquired Aptana Studio (an Eclipse based integrated development environment optimized for web development) and the company now offers two (free) versions of the Aptana IDE: Aptana Studio and Titanium Studio (which is optimized for Titanium SDK projects).  Titanium SDK and Titanium Studio are free and open source but extended support is available on a paid subscription basis from Appcelerator.  

Cross compilation is the major difference between between Titanium and PhoneGap (see Part 3 for information concerning PhoneGap).  The PhoneGap approach is to embed a web application in a hosted native code shell which is then compiled.  The base web application code, however, remains a combination of JavaScript, HTML  and CSS which is hosted “as is” by the PhoneGap native code shell.  Titanium Appcelerator, on the other hand, cross compiles JavaScript into a native code programming language (e.g. Objective-C for iOS or Java for Android); a fully native code project is created and compiled.  In other words, a PhoneGap project hosts an unaltered web application where Titanium Appcelerator translates the Titanium JavaScript project into a standalone native code project.  Any changes or additions to the Titanium project are made to the Javascript code in the base project which is then cross compiled to produced updated native code source as needed.  In effect, the developer is using Javascript to create native code projects.

In addition to Titanium, the native code programming toolset for each target device needs to be installed; for iOS, Xcode would need to be installed and for Android, Java and the Android SDK are required.  Titanium, however, handles accessing the native code tools transparently; apps are either run on a desktop simulator that is included with each set of tools or the app is deployed to a physical mobile device.  Typically the developer only interacts with Titanium or the Titanium Studio interface which in turn transparently calls the native code tools behind the scenes.  (The developer, however, can optionally open and edit a native code project generated by Titanium directly if desired but this is not a common or recommended practice.)

In theory the fully native code project produced by Titanium should run faster than a PhoneGap project but actual comparative performance varies with each new release of each product.  Both products allow the user to create mobile applications using web development tools and technologies (i.e. Javascript, HTML and CSS).  As with PhoneGap, there are limitations to Titanium compared to developing directly in a native programming language but Titanium is suitable for a range of projects up to moderate levels of complexity.

Titanium also allows multiple deployment targets (iPhone, iPad, Android, etc.) to be managed from a single base project (though in practice Titanium’s support has historically tended to be more robust for iOS than for Android).  (Additionally, Titanium can also be used to build both standalone cross platform desktop applications and mobile web sites.)  

Titanium Mobile SDK
Titanium Studio