just a dude abiding

Thoughts on Appcelerator Titanium

Appcelerator Titanium is a product that bills itself as the easy way to create cross-platform, native, mobile applications. It’s a lofty goal. After several months of development on a decent sized application, I can say that currently the platform falls short of meeting that goal, way short.

A promising start..

I was drawn to Appcelerator because of the idea of being able to write straightforward JS and get native widgets. This would allow me to focus on the logic of my application, and not making sure I hadn’t forgot to track the retain/release counts on my objects correctly. Initially I was able to make tremendous progress in mocking up the UI. Sure I don’t get the great Interface Builder, but with minor tweaks I can deploy to Android! What had taken me weeks to sketch out in Obj-c was taking me hours or days instead. Multi-level navigation heirarchies with back buttons? Easy! But shortly after I reached the end of mocking up my UI flow, I began running into trouble. The documentation for the platform was sparse, but seemed to be improving. If you got really stuck, you could look at the “KitchenSink” sample app to see how various components worked. This isn’t too bad, but progress is slowing…

It does what?

So the first clear sign of troubl was that I had to use a separate application (Titanium Developer) to build/launch/monitor my applications. There wasn’t (and still isn’t) a visible method to run an app from the command line, or even to just generate code to run from within XCode. Sure, Titanium Developer is a bit slow, a little clumsy, and not terribly stable, but the code is going so much faster it’s bound to be worth it. Surely it is. I was wrong. Titanium Developer rapidly became the bane of my existence. It’s only syntax/static checking is done via JSLint with a pretty arcane set of rules. Want to write one line if statements? That’s a warning. A for loop without checking for property existence? That’s a warning. Appcelerator’s own sample app generates hundreds of JSLint warnings. What use are warnings if they are too verbose to find real problems? Get used to missing a comma, or a semi-colon, and it going unnoticed in the sea of other warnings.

Once I settled into the fact that the Titanium Developer app itself is pretty brutal to work with, I moved onto the next set of troubles. The documentation is terrible. It’s a simple API doc, with almost no supporting code, and nearly useless descriptions for many properties. If you really want to know how a particular API or widget reacts, you have to look at the KitchenSink and hope your use case is covered. If it is covered, then you have to figure out how to work with the spaghetti nature of the sample app, and shoe-horn it into your app. If it’s not, then you’re off to the next giant pain, the community forum.

The idea behind the community forum is great, a place for users to ask and hopefully answer each others questions. Instead what you find are questions that are 6 or 7 months old, unanswered, full of “any update?” responses. The most common official responses are “please provide Titanium and platform SDK versions”, with no follow up. When there are solutions, or work arounds, they may no longer be applicable to the newer versions.

Minor platform versions routinely caused regressions in functionality (like grouped table views scrolling whenever the keyboard is present) while adding more ways for Appcelerator to make a dime (paid Modules), but without fixing persistent, core problems. Don’t get me wrong, they deserve to make some money off of their product, but leaving broken functionality in place for months with no expected resolution dates just doesn’t cut it. Some recent examples of major platform bugs: ‘swipe’ gestures not being handled correctly or consistently including in their own custom horizontal scrolling view, platform specific overrides not working on devices (but working fine in the simulator) on iOS. And more that I’ve probably blocked out for my own sanity.

Almost there…

I managed to suffer through all of this, I’d put too much time and effort into the app to give up yet. I’m too close to the finish line. I’d become used to the undocumented idiosyncracies (like event propogation failing if you add subviews after the parent view has been added, or image views that cannot be scaled in a logical fashion, strange positiong issues if setting both lef/right or top/bottom). It was time for some last minute bug squashing, and pushing the data off to beta testers! Thanks to the fantastic TestFlight we were able to gather a group of testers, and get our permissioning setup to be able to send them an ad-hoc build. Now all I have to do is get a clean, release build ready.

Great, Titanium Developer crashes everytime I try and create a release package. The builds take 5 or 6 minutes, have no stop button, and often hang the Titanium Developer UI. The only way to kill a build that’s already begun is to `killall xcodebuild`, which is certainly not documented. After waiting for the full rebuild (it doesn’t appear to cache ANY compilation steps), I am greeted with a large build log error. Usually about a failure to copy some file. The good news is that at this point Titanium Developer has generated a functional(ish) XCode project. Open it in XCode to find…it hasn’t set my distribution profile at all, it doesn’t seem to be targetting the correct platform, and in fact seems to be defaulting to a debug build. In fact some of the generated code seems to still be set to debug mode, must be a custom script that runs outside of XCode to fix that…

An hour of learning what isn’t set correctly in the generated XCode project and I’m finally building again. Replace a few missing files (default icon, and Default.png don’t seem to copy correctly), fight with provisioning profiles some more, and a build is finally made. Now I load the fresh beta release onto my device, and immediately find a bug that didn’t seem to appear in the simulator, curse loudly, and call it a night.

Lessons learned?

Middleware platforms are a great idea, in theory. In practice it means working through a vendor who is struggling to keep up with the underlying platforms, stuggling to support their paid customers (speculating here), and completely failing to support their free user base. There is practically no external community for the Appcelerator platform, no solid bare bones starter applications, gotcha lists, or much of anything else. It’s a community of people all fighting to get their project done, and get the hell out of the way. I’m sure they mean well, but things don’t look good.

I’m monumentally disappointed in the current state of the Appcelerator platform, community, and toolset, and have no plans on doing further development on the platform after completing my current project. I’m just going to cut my losses and either go back to direct native development, or forget native development alltogether and get with "PhoneGap"http://phonegap.com/