May 21

PhoneGap – Cross platform mobile development

BJ sent me a link to PhoneGap yesterday and asked me to take a peek at it, here are my two cents on it. PhoneGap as a whole is extremely impressive, but it's probably more ambitious than functional at this point. The main selling point for the platform is that there is practically no barrier to entry for web developers. You develop applications on it using css, html and javascript, which is going to be a welcome alternative to objective-c / Java for most of us. Another immediate advantage to this is that it makes creating a seamless experience between a website and an iPhone app pretty easy, you can just copy the css from your website to keep the same look and feel. PhoneGap extends portions of the APIs for Android, iPhone and Blackberry devices and abstracts them into a javascript framework, the key here is that it abstracts them all into the same javascript framework, so your code will run on all three devices in more or less the same fashion. All of this needs to be taken with a grain of salt though, there is still a lot of functionality you lose out on, the PhoneGap wiki has a nice chart that lets you see what you can accomplish so far. Needless to say, the lack of support for features like the camera or the local filesystem is a little disappointing. The other main gripe I have with the platform is that it kills the efficiency of your applications, I made up a little chart to give an idea of what is going on when you create a PhoneGap app, we'll focus on the iPhone since it's the best supported platform so far: [caption id="" align="aligncenter" width="525" caption="Basic structure of a PhoneGap application on the iPhone"]Basic structure of a PhoneGap application on the iPhone[/caption] Normally when you write an iPhone application, your code executes directly on top of a "sandbox" area that is kind of like a sequestered portion of the operating system which the iPhone gives limited access to. It's not a terribly efficient process to begin with, but it gets the job done. For PhoneGap applications, they run their framework in that sandbox, which in turn runs safari, and then safari's javascript interpreter (webkit) which itself is a virtual platform, executes your code. The entire process decreases the efficiency of your application by quite a bit. Aside from efficiency, there is other baggage that comes with writing your applications on top of a javascript interpreter: you're at its mercy. If at some point in the future there is an update to webkit which doesn't jive with the code you have written, your entire application is hosed and you'll need to release an update for it. In any case, despite its shortcomings, PhoneGap is a promising platform for simple iPhone applications, the project is well documented due to an active and knowledgeable community, and that's a good sign of it maturing as time goes on.