Monday, July 19, 2010

The Titanium Promise

I've been hearing a lot of talk around Appcelerator's Titanium framework lately.  Appcelerator has found a way to ease the development of apps across the iOS and Android operating systems, with blackberry support trailing not far behind.  They provide a free SDK that allows you to write your mobile application in JavaScript and compile it into native applications for multiple platforms.  This is huge and could mean significant savings in development costs.

I spent a some time looking into the framework a few weeks ago in preparation for Today's hands-on tutorial.  My initial sentiment was that the framework is still in its infancy.  Having sat through this tutorial, my original assessment remains intact.  Appcelerator does not provide an IDE or a step-through debugger which is kind of annoying, but that's not really a show stopper.  My biggest issue is that I was often faced with compilation errors when trying to build and run a brand new project or their kitchen sink demo.  At first I thought that I massacred my dev environment, but Today's presentation was regularly interrupted with similar "I'm getting several errors when I do that on my system" comments.  It turns out that the release of iOS 4 broke a few things in the Titanium framework and we all had to install an unreleased version to circumvent the errors.  That solved the immediate problem but it uncovered an even bigger issue; the Titanium framework is heavily dependent on third parties that they have no control or influence over.  What makes this even worse is that one of those third parties is Apple.  That dependency reveals two major risks for a developer:
  1. Apple can drastically change their SDK and/or tools with little to no notice.  If this change breaks the Titanium compiler, you may not be able to release an updated version of your app until Appcelerator releases a patched version of its SDK.   You'll probably still be able to build it using the older Apple SDK, but picture this scenario:
    1. Apple releases iOS 4.0 which breaks the Titanium build.
    2. iPhone/iPod owners start upgrading to iOS 4.
    3. There is a problem with an existing Titanium app when running on iOS4 that causes it to crash.
    4. The developer is unable to release an updated version which will fix the crash in iOS4 until Appcelerator fixes the Titanium build.
  2. The Titanium framework is flirting with Apple's updated terms of service.  Titanium apps are currently being approved into the app store, but knowing apple, that could change anytime.  Steve Jobs' infamous open letter talked about a common denominator for features which could potentially be applied to Titanium.
All of this might never end up causing any issues.  It's probably in Apple's best interest to keep allowing quality Titanium apps into its store since it makes their devices more appealing.  However, it is notable and probably worth mentioning to stake holders.

There is another important piece of information that I learned over this session that was not obvious before: the JavaScript code is not cross compiled to Java or Objective-C.  The Titanium SDK generates Android and XCode projects and does compile native binaries using the XCode and Java compilers but the app itself is not really a native app.  The application that results from this process, atleast the iPhone version, is essentially a JavaScript interpreter with your JavaScript code compiled into it as a string resource.  This has several implications:
  • Performance is sacrificed for convenience.  No matter how well you optimize your JavaScript, it simply will not run as fast as if it were compiled to native machine code or byte code.
  • Though the JavaScript code is minified and obfuscated, it is most likely still very easy to reverse engineer.  Other JavaScript frameworks like Google's GWT suffer from the same problem except that in the GWT case, you can move some of that sensitive logic to the server.
Don't get me wrong, there were a lot of good things that came out of this presentation and the Titanium frameworks still have a lot to offer.  The use of JavaScript and it's literal syntax makes it easy to build apps in a decoupled fashion and the event handling model will be familiar to any web developer.  There was also mention of a community effort to build a tool that can take a XIB file and convert it to declarative JavaScript to build the UI.  It apparently works well, though I'm not sure about the maintainability of this approach.  The framework can surely ease the development of most apps available Today, but it is still young and has room for improvements.  The Appcelerator team has big plans for the future such as providing an IDE with a step-through debugger, support for universal binaries, and more.  If you're working in the mobile space, you should definitely keep an eye on it.  I know I will.

1 comment: