Home  >  

PhoneGap: my new favorite open-source project

Author photo
| | Comments (11)
AddThis Social Bookmark Button

The real problem with mobile development is that you need to learn a new language. Every platform currently has their own unique language for writing applications, and some of them are downright obtuse (I'm talking to you, Objective-C for iPhone.) With the number of mobile devices and mobile internet connections exponentially rising, it was only a number of time before someone made it easier. Enter PhoneGap.

PhoneGap is an open-source technology that lets developers write applications in JavaScript for mobile devices. PhoneGap currently supports Google Android, the iPhone, and the Blackberry platforms. PhoneGap goes beyond just letting users wrap AJAX apps into mobile languages - it gives developers access to the rich features that make mobile useful and important, like the accelerometer, geo location, and phone vibration. As the project is still in development, expect the feature list to expand until every feature is available in JavaScript.

If you've followed my posts lately you'll know that two of the big trends I see for 2009 are JavaScript and Mobile. Mobile as a platform is already outpacing the computer-based browser and I don't see this changing, well, ever. JavaScript is quickly turning into the lingua franca for all types of web development, being ubiquitous and flexible enough to power just about any type of development in question. I get asked a lot what languages I think people should learn and what types of development they should do to stay as marketable as possible. My answer for the last year has consistently been to learn JavaScript, and program for mobile devices.

Not convinced that JavaScript is right for mobile applications? Think of it this way: as a developer, your time is worth money, and if you've ever been free-lance or hourly you know exactly how much. Every hour you invest in learning a new technology is just that: an investment, in very real terms. For every hour you spend learning a new technology you're betting you'll get a "return" in future projects in that technology, where you can charge a premium because you know something other people don't. Now imagine you could cut that initial investment time in half, maybe even reduce it by 75%, by learning to work with a set of libraries in an existing programming language you're fluent in. See what I mean?

JavaScript surely has it's pitfalls (I'd personally rather use Actionscript for everything), but I for one am grateful to see it break into the mobile space in such a meaningful and powerful way. Hooray for PhoneGap, and here's to a long and successful future until mobile platforms standardize themselves on something better.

Read more from RJ Owen. RJ Owen's Atom feed rjowen on Twitter

Comments

11 Comments

Chris Brind said:

This doesn't make sense, "where you can charge a premium because you know something other people don't" but you've already implied that everyone should learn JavaScript.

As a freelance, what is your USP if you're just offering what everyone else knows as well? Well, then it comes down to your rate, you'll have to reduce it to compete.

I'm not saying don't learn JavaScript (let's face, it is a piece of cake and anyone who's done any kind of OO or scripting can probably pick it up in a few hours or less), but what I am saying is, don't ditch those 'obtuse' languages, because they are what will make you stand out from the crowd.

Besides which, apart from a very lightweight core API, there's not much to JavaScript, which means you can't say you're a JavaScript expert, all you can say is you're an AJAX expert, or some other API based on JavaScript. While it might be easy to learn the core language and specification, you'll still have a learning curve with any of the APIs you actually want to use JavaScript with.

Now compare JavaScript with Java... If someone tells me they're a Java expert then I can assume (and will probe to check) that they know the Java 5 API inside/out. That's a lot more power than core JavaScript APIs. If someone said to me "I'm a JavaScript expert", my response would be, "well, who isn't?"

RJ Owen said:

@Brindy: I agree to an extent. It's true that if everyone learned JavaScript and PhoneGap then the value of the services would go down and you'd make less money. However, I doubt this is the case. At least in the short term, if you already know JavaScript, you can probably come up to speed on PhoneGap very quickly, and charge a premium writing apps for mobile without spending the ramp-up time others will need.

An important point I left out of the post is that it's unlikely that all of these "obtuse" mobile languages will survive, but for now it's impossible to choose the winner. I can't imagine that we'll still have competing Android, Objective-C and Blackberry C++ in 3 years. Even if one of these languages does survive and come out on top, it's unlikely it'll look the same.

Learning them now will definitely give you an edge, but unless you plan to dive heavily into development for that specific platform, I think you can get a better bang for your buck using PhoneGap.

A good analogy is the car industry. Warren Buffet often tells this story: in the early 1900's, most people would think you'd be smart to invest in the auto-industry. Cars were the newest big thing and taking out the horse and buggy market whole-sale. The problem is that at that time, it was impossible to pick the right car company to invest in. There have been over 1000 car companies in the United States since then, and almost all of them failed. Making the analogy to mobile development, there are many different options for mobile development right now. Until a clear front-runner emerges, it's risky to invest too heavily in any single one of them. If you can develop for mobile using a technology you know isn't going to go anywhere and is useful for other RIA development (i.e. JavaScript), then it seems like the best investment from a time perspective.

Another possible benefit is if you can keep to a set of features that are supported on all platforms and by the framework, maintaining a common codebase for these different devices becomes a lot easier. That's a big win for the type of device development that makes sense from a business perspective - as another channel to a service.

@Chris - I take your point about javascript being a platform for frameworks, like AJAX frameworks, but I totally disagree that you can't become an expert in Javascript. An expert in Javascript is someone who understands how a prototype language works and understands how code sharing works in that kind of language. They can come up to speed quickly in, say, JQuery because they understand what's being done to accomplish the things the framework does. It's possible to be just a JQuery expert, but it's also possible to be a Javascript expert apart from that.

Chris Brind said:

@RJ - Don't get me wrong, I agree that tools like PhoneGap have potential benefits for creating cross mobile device applications using RIA skills rather than native coding or learning yet another language, decreasing time to market, and all that good stuff. That will no doubt appeal to the majority of the audience reading this website and I'll be giving it a go myself, as I am intrigued about how it handles memory management. That is, WebKit should handle it for you, like it does for any web page/JavaScript application, but how well does it do it?

However, if you were to decide to back a native SDK, then personally I would chose Objective C. Objective C has a very long history and compared to a lot of languages/SDKs is very mature. It isn't an SDK that has sprung up from nowhere (unlike Android). The iPhone SDK is very much a subset of the SDK used to develop native Mac applications. In fact the documentation for both is pretty much the same, with the differences for iPhone being pointed out along the way.

My comment was really just because I found your justification a little dichotomous.

@Tony - JavaScript is/will be a good channel for having a common subset of functionality across a range of devices, but at best you can only support a common denominator. It is not reasonable to expect that all the devices will deliver the same functionality as they are all trying to compete for the market. If you try to do any more than support a common denominator then you get in to a situation where you are wanting to discover the device's capabilities in order to provide extra functionality on the fly and that's already been done (CLDC and MIDP), arguably, not very successfully.

Rich Tretola said:

Perhaps AIR on mobile will be the solution to write once deploy anywhere. I know this is the goal of Adobe and I hope they can pull it off. It has certainly been a viable strategy for desktop development.

Chris Brind said:

@Rich I really hope so too, I can't think of a better, simpler approach than using AIR. However, while I hear that Adobe and Apple are talking about getting Flash on to the iPhone I'm just not going to hold my breath as I can't see Apple allowing Adobe to get around using the App Store. Unless they allow AIR apps to be downloaded via the App Store or something like that. But if then if they do that, then people will be less inclined to buy a Mac so that they can use the SDK, etc. I just don't see how it is in Apple's interest, unless they have some evidence to suggest that they'll sell more iPhones as a result.

I know a lot of people Jailbreak their iPhones (I've seen JBoss and Knoplerfish running on JamVM on iPhones), so can't imagine that it would be that difficult to get Flash player running, just not in an official context and jailbreaking isn't something I really want to do to my iPod Touch anyway (I don't have an iPhone just yet anyway).

Rich Tretola said:

Good point Chris, after all it is always money that drives the corporate decisions and not simply what the consumer may want. :-) Also, as far as Adobe working with Apple, they are actually working with ARM directly on Flash Player optimization for their new chips. I have assumed all along that it is strictly financial reasons as to why Apple was not part of the open screen project.

Lee said:

One big problem is with PhoneGap, not the use of JavaScript and a UIWebView framework, is that it starts gathering GPS information as soon as the application starts and doesn't stop until the app is terminated even if your application never uses the GPS location data.

The GPS hardware on the phone uses a lot of battery resource. If you don't believe me then just turn on the map app and start tracking yourself for a period of time.

This means that an app built with PhoneGap is , as Apple says, not a 'good iPhone neighbor' since it can readily use up the battery and not leave sufficient battery resources for phone calls and the running of other apps.

Because of this, an app created with PhoneGap should only be run for short periods of time compared to other applications.

A better solution is to turn the GPS location information on and off as needed. In fact this is what Apple suggests. QuickConnectiPhone is a more complete implementation of what PhoneGap is trying to do. It has more features, with Bonjour Networking coming in version 1.5. Work is progressing on the ports to the Mac, Linux, Android, and Nokia phone environments. The installer includes Xcode templates for iPhone and Mac applications and a template for Dashcode as well. A version for PHP is available for download as well.

Give it a try. I would be interested in hearing what you have to say.

Anonymous said:

have any of you heard of/tried using the skyfire browser on your phones? it's still in beta but you can pretty much run a flex 3 app on it with out a problem. The browser itself is nothing to scream at, but the simple fact that it runs flash 9 is awesome.

the memory/cpu issues of a phone aside, it ran just as smooth as it does on the desktop.

Raj said:

it would be a dream come true if javascript let you do everything you could with iphone sdk. however its a nice start. personally i am all for javascript as a standard development across different platforms.

i have boookmarked your post at http://www.iphonekicks.com/opensource/PhoneGap_my_new_favorite_open_source_project

Raj said:

@Anonymous - i tried skyfire and although its still in beta, i found the rendering too slow to be of any good. its awesome that they support flash, however as an end user you really cant do any meaningful surfing on skyfire due to its really slow rendering and zooming. they still have a very very long way to go if they want to be somewhere close to opera mini or opera mobile.

i am eagerly awaiting a mobile browser from mozilla though, and support for plugins on mobile would be awesome. if they get it right then i think they can beat every mobile browser in the market in no time

- raj
http://www.iphonekicks.com

Leave a comment


Tag Cloud

Question of the Week: Dream App

If you had an unlimited budget and unlimited resources what application would you build and why would you build it?

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.