When to Use Appcelerator Titanium vs. Native Code
14 July 2014
When should you use Appcelerator Titanium and when should you write native code?
Appcelerator Titanium is a suite of tools allowing developers to write mobile applications in javascript. At execution time, the Titanium framework executes and interprets the javascript to instantiate native UI elements. The main idea of this framework is that developers don’t need to learn different platforms. Native codes, SDKs, and only one set of javascript code can be executed on different mobile platforms – especially iOS and Android, but Blackberry and Windows Phone as well.
Exygy has been working on several mobile applications, some written in native code and some using the Titanium framework. Here are a few thoughts on why we are about to switch one of our applications from Titanium to native code.
The application is straightforward: users can look up product information by scanning barcodes or searching product names. Titanium was chosen for this project because it solved one of the main challenges: barcode scanning. Thanks to the Titanium Barcode scanner module, we were able to facilitate the scanning process.
However, the barcode module had appeared to be broken prior to Exygy’s correction, and had not been given attention for a year. (Exygy’s correction can be seen here.)
The UI application had also been an ongoing issue, as it required additional time to modify some of the Titanium default behaviors. We built a module: ExygyHideAndroidTableViewSeparator to remove tableview separators on Android and we modified the Titanium SDK source code to remove the navigation bar drop shadow in iOS 6.
After several rounds of updates, we added a prominent number of features to the application. These updates include sharing information on Facebook, Twitter and Google+, as well as push notifications, scheduled local notifications, and allowing users to “favorite” products for example. Again, the integration of some of this functionality required us to write modules and/or modify the Titanium SDK.
As of today, this app is built on a highly custom version of the Titanium SDK. Each Titanium SDK update requires some work to regain the level of customization, after each build – some dependences need to be re-added to each native code project (iOs / Xcode in particular). This process is very time-consuming and adding simple features takes 3 to 4 times the time it would take in native code. Not even mentioning how to keep track of a custom SDK, javascript code and compiled project in version control.
To conclude, Titanium SDK is well-suited for applications that do not require functionality other than that provided by the javascript SDK itself. Business applications that are meant to populate databases are perfect examples of what Titanium is good for.
However, applications like the one described in this post requiring advanced UI elements and out-of-the-box functionality might be better to start in native code right away. What seems to be a time saver at first (one set of code for 2 platforms) has shown its limitations and it is time for this application to be rewritten using the latest native iOS and Android SDKs.