iPhone development tools that work the way you do

1 2 Page 2
Page 2 of 2

Titanium lets you string together native iPhone components with JavaScript.

The role of HTML and CSS here is a bit diminished. While you can certainly mark up pages in HTML and use all of the AJAX tricks with your pages, the simplest solution is to avoid it. Many of the examples from Appcelerator begin with HTML files that include just a few lines that fire up the JavaScript that does the real work. If you write CSS, it will affect the HTML that you add but not the controls created by Titanium. They'll follow Apple's UI guidelines. I wouldn't be surprised if the CSS file in your project is completely empty and the HTML has just a few lines that invoke the JavaScript.

Much of this could change in the near future because the mobile platform is still in a closed beta program. The company is rolling out new features frequently; it added a number of new widgets in version 0.5 released just a few days ago. The latest includes access to the accelerometer, the camera, and the geolocation data, all available in JavaScript.

The current version produces applications for only the iPhone and Android, but the structure should allow Appcelerator to move to other platforms in the future if it so chooses. The fact that Titanium can work directly with JavaScript instead of HTML and CSS means that it may even port neatly over to older phones that don't use WebKit. That's speculation, though. Appcelerator's road map is clearly focused on the iPhone and Android.

Ansca Corona At this writing and perhaps for a long time to come, Flash code is ignored by the iPhone. Flash developers, though, now have a way to put their scripting skills to use on the iPhone: by using Ansca's Corona SDK. You write Lua, and Corona turns it into an iPhone app.

This framework may be the most accessible to many Flash and game developers because Lua is often used in these worlds. Flash Lite games, for instance, should translate relatively easily, although adapting them to use the accelerometer and the multitouch screen will take some work. The Lua language includes a number of basic features that makes animation simple.

Ansca adds several new features to the language designed specifically to help animators. The transition and easing methods will help calculate all of the positions for tweening objects in the display, something that helps set up animations. It won't handle complicated curves, but it will work with linear, quadratic, and exponential transitions.

The framework handles all of the details of initializing OpenGL and the Objective C, making it easier for Flash programmers to create iPhone applications without learning about pointers or malloc. Not every part of OpenGL is available through Lua, though. Three-dimensional extensions are still in the planning stages. You're limited to 2-D games, just like most Flash developers.

Corona's Lua is made for sending sprites dancing across the screen.

The event code is also focused on single touches. Every object floating across the screen can have its own event listener that makes it simple to detect a hit, but there's no mechanism to handle multitouch events like pinching and spreading the fingers. Ansca is also still experimenting with distinguishing between dragging and tapping events.

I think that the developers of casual games will love this tool because these games are usually coded in Flash and limited to two dimensions. While some developers might want to wait for full three-dimensional access to OpenGL, I've found that my favorite games on the iPhone are limited to 2-D. While the screen resolution is wonderful, it's not good enough for realistic 3-D; depth can only be fudged by having objects move. It's funny, but my favorite games on the iPhone tend to look like the arcade games from the '80s. If that's what you want to create, you can do it quickly with Corona.

Four good tools The amount of success you'll find with any of these frameworks depends entirely on what you're trying to do. None of these SDKs is ready to produce something as sophisticated as Super Monkey Ball because all of them are limited to two-dimensional applications. If you want 3-D, you'll have to do much of the work yourself.

They also require a certain amount of overhead, and this slows down the applications, although not as much as you might think. The developers of Corona, for instance, are paying close attention to the size of their interpreter. They are proud of the fact that it is only 200KB, dramatically smaller than Flash in part because it doesn't have the same need for backward compatibility.

Corona is probably the best bet for two-dimensional games. I wouldn't want to tackle many games with PhoneGap, Titanium, or Rhodes, although a sophisticated AJAX hacker would be able to do anything that could be achieved with a browser.

PhoneGap, Titanium, and Rhodes are best for letting the user page through menus to browse databases filled with information. They handle many of the basic animations and transitions, and you provide the data and the basic layout. These frameworks are also good if you want to produce an Android application at the same time. Rhodes currently promises the most cross-platform support, although I wouldn't be surprised if PhoneGap and Titanium start catching up.

It's still too early to make a decision based upon price. Neither Corona nor Titanium are quoting costs yet. PhoneGap is an open source project with sponsor Nitobi standing ready to offer professional support. Rhomobile Rhodes is free if you distribute all of the source code to your application with version 3.0 of the GPL. If you want to retain the source code you write, you can buy licenses based on a percentage of revenue. Enterprise users can also buy licenses by the seat.

The technology itself is solid and very functional, but the politics are complicated and shrouded in secrecy. Emulating one language in another is an old trick that programmers have been using since the days when punch cards were bigger than the iPhone. But even the keepers of the mainframes in their air-conditioned temples didn't enforce regulations like Apple does, and these rules are the trouble.

No one knows what Apple is afraid will happen if a user downloads new software for the emulator without Apple's permission, but it's clear that the SDK requirements forbid developers from adding new features or grabbing new code from the Internet. The company routinely rejects some but not all of the applications that use emulators. (Again, see my personal tale of rejection.)

The companies behind the products in this review are taking different tacks. Rhomobile embraced Apple's goal of thorough testing and stripped out the eval function from the Rhodes implementation of Ruby's interpreter. The company has also worked closely with Apple to make sure that the applications built with its tools can't change their functionality. Rhomobile says it's had no trouble with rejections as a result.

[ Dive deep into mobile 2.0 technology with InfoWorld's "mobile 2.0" PDF special report. ]

Some of the developers using PhoneGap have started campaigning publicly in hopes of getting Apple to understand the advantages in the PhoneGap approach. For instance, read about developer Mike Nachbaur's initial and subsequent dealings with Apple's App Store.

There are counterarguments that frameworks like these speed the approval process by reducing the chances of your inadvertently implementing a user interface that violates Apple's guidelines. Objective C developers often run aground when they try to do something themselves and find that their own solution isn't correct. (See Jared Brown's story, App Rejected, and the Macworld forums for examples.)

Programmers using toolkits like these don't make the same beginner's mistakes. While Objective C is quite a nice language, it's also not clear that it's the right tool for anything but high-performance games. Pointers are dangerous items even in the hands of excellent developers. Memory management and threading can be quite confusing. These toolkits remove many of the land mines from the paths of the developers and save them some grief. The software industry builds layers like these because they make everyone's life easier. Emulators and methods like eval are excellent tools. Apple would do well to open themselves up to a wide range of modern languages.

The Rhomobile, Nitobi, Appcelerator, and Ansca tools make it dramatically faster to create applications. The results are often more standards-compliant than using Objective C, but like any other tools, how you use them varies. If the App Store reviewer enjoys the final app, the odds for success are much better. By making it easier for JavaScript, Ruby, and Lua programmers to concentrate on designing the app, not learning a new language, these tools offer a head start.

Related articles

  • iPhone App Store roulette: A tale of rejection
  • How to choose a mobile development platform
  • A developer's-eye view of smartphone platforms
  • The cross-platform option: Web apps for smartphones
  • InfoWorld's Deep Dive Report: Mobile 2.0 Tech
  • 21 apps Apple doesn't want on your iPhone
  • Mobile deathmatch: Palm Pre versus iPhone
  • Deathmatch rematch: BlackBerry versus iPhone 3.0
  • Mobile deathmatch: BlackBerry vs. iPhone 3.0, side by side
  • How much work can you do on an iPhone?
  • How much work can you do on a BlackBerry?
  • Can you manage an iPhone like a BlackBerry?
  • First look: iPhone 3G S is evolution in action
  • First look: iPhone OS 3.0 is better for business, but IT won't be satisfied
  • Your next iPhone: iPhone 3.0 update or iPhone 3G S?
  • iPhone 3.0: An InfoWorld guided tour
  • iPhone applications get down to business

This story, "iPhone development tools that work the way you do" was originally published by InfoWorld.

Copyright © 2009 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2
7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon