Phonegap vs. Titanium
Monday, July 2nd, 2012 03:59 pm GMT +2
For a while we’ve been spiking on different solutions to implement mobile app for our platform, and here are some of my initial thoughts on the problem. Given that I’m too lazy and not so enthusiastic about Objective-C for iOS or Java for Android I was searching for some solution which could deliver value from both worlds with minimum initial effort.
Phonegap (hybrid approach)
Pros
- Ability to develop apps in HTML5 ( means more web devices are captured)
- Overall speed of iterative development is high (it’s almost like refreshing the page)
- Easy to debug (remote WebKit console in Emulator)
- It’s JavaScript!
- Huge amount of JS-frameworks for touch devices (Sencha, iUI, jQuery mobile, iWebkit, etc) ready for use
- Ability to make bindings to native hardware by writing Objective-C plugins
- Good documentation & large community
Cons
- Overall performance of demos is poor
- Contact list demos with huge amount of data just crash Safari (tested on hardware)
- Building custom GUI is limited by HTML/CSS, there is a huge risk of ending up with unresponsive UI
- A particular weakness of Phonegap is that it’s being migrated into Apache incubator & development/docs seem a bit messy
- Adobe recently bought Phonegap & most probably their focus will shift towards Adobe’s AIR platform
Titanium (native approach)
Pros
- Javascript, no need for Objective-C
- Resulting app is Native!
- Possibility to fully customize GUI
- Produce HTML5 version of your application (works in browser!)
- Ability to write cross-platform code for Android as well (also native!)
- Titanium IDE (a free integrated development environment based on Eclipse, ex-Aptana)
- Ability to make bindings to native hardware by writing Objective-C plugins
- A shift towards iPhone development first (Android comes second) — which is adequate for current market shares of both
- Community & company behind Titanium seems to be pretty responsive
- Appcelerator recently raised 15 million series C funding, which means they are serious about the platformm & will
continue to improve it - Appcelerator is known to be largest third-party app publisher on both iOS and Android and is used by companies like NBC, Zipcar, eBay
Cons
- Even though it’s Javascript, you’ll have to learn Titanium mobile API
- Some developers had hard time debugging their apps & catching memory leaks
- Documentation is somewhat messy & not as perfect if compared to Phonegap, however there is a positive improvement trend since the beginning of this year
- A sort of platform lock-in, which means that in the long run it will be way too hard to switch to other mobile technology
Just to make it clear, Titanium does not produce fully native code from your javascript. It does not compile your code to ARM opcodes, what it does, in fact,
is binary javascript interpreter (Webkit’s JavascriptCore on iPhone, V8 on Android)
A note on hybrid approach
By hybrid approach I mean usage of HTML5/javascript with hooks into native iOS/Android API calls.
Of course, both Titanium and Phonegap fall into the category of “hybrid” but the key difference is implementation:
while Phonegap application runs inside browser, Titanium’s app runs inside javascript interpreter
Hybrid approach seemed like a real option, but in fact for custom/responsive GUI app you’ll inevitably need a lot of
code to support native UI. Hybrid works for small features like accessing accelerometer, camera, phone’s contacts, etc.
It seems that creating complex & responsive UI in HTML5 is not really possible, thus UX will be pretty
limited. Hybrid approach for the UI part is not a good fit from the development point of view:
- Large amount of platform specific UI code (Obj-C) + javascript leads to technology fragmentation which is generally bad
- a lot of quirks to connect native platform & javascript app leads to poor app design which will hurt you in long run
Conclusion
As you might guess, in the end it all comes to what type of application you’re going to build. If it’s mostly data-access, satellite mobile
application to your mainline app, than Titanium might be an option to consider. If you’re building something more similar to Path,
you’d better start right from hiring Objective-C folks.
And yet another warning, if you’re looking for cross-platform mobile application development, Titanium might not be a good choice.
Bad news, there’s no silver bullet here. Though, it does provide some mechanisms to do it well, but the dream of writing one single codebase
and ability to produce native apps for multiple platforms is very hard to achieve.
- Native app for iPhone & Android (rich UX, more happy users)
- Huge company behind Titanium, paid support which means you’ll not be left with your problems alone
- Hundreds of successful apps already made with Titanium which fit Nimble API model (i.e. they are not standalone)
Phonegap | Titanium | |
---|---|---|
Language | Javascript | Javascript |
Dev toolkit | poor | IDE, almost full integration |
Custom GUI | Bound by browser’s CSS engine | Native capabilities |
3-rd party native plugins | Yes | Yes, there is even marketplace |
Community | Large | Large |
Documentation | Good | Good |
JS skills required | Web-dev is enough | Need to learn custom APIs |
App performance | Mediocre | Good |
Debugging | Easy | Hard |
iPhone support | Yes | Yes, first-class |
Android support | Yes | Yes, second-class |