CIO

How Cross-platform Tools Make It Easier to Develop for Both iOS and Android

If you're building applications for Android and iOS, cross-platform mobile development tools can make you more productive. Just don't expect the results to look pretty.

Android and iOS are the two key mobile operating systems. Not coincidentally, they are the two that also cause huge headaches for app developers.

That's because if you develop apps for both iOS and Android the way that Apple and Google encourage you, you need to develop and maintain two source code bases for the two different platforms. That means different tools ( Apple Xcode and Android SDK), different APIs, different languages and so on.

If you're involved in developing mobile apps for use within your enterprise and you have a BYOD policy, things could soon get even worse: If Windows Phone 8 gains traction, then the number of platforms you may have to support will expand from two to three.

"There is huge need out there amongst mobile developers, and especially in enterprises where mobile development is escalating rapidly, to increase the productivity of development," says Al Hilwa, IDC's software development research program director.

Market for Cross-platform Mobile Development 'Growing Rapidly'

One solution is to use JavaScript or HTML5 - languages that were designed to render on multiple operating systems. But these haven't proved to be the ideal option for which many developers had hoped. Performance has often been disappointing, maintenance can be time-consuming and the access they provide to specific device features is often limited.

A more promising solution may be multi-platform development environments that let you develop a single code base and compile it to run on different mobile platforms. Xamarin, for example, lets you write apps in C#, calling any native platform APIs directly. The Xamarin compiler then bundles the .NET runtime and outputs a native ARM executable, packaged as an iOS or Android app.

Embarcadero's RAD Studio XE5 does something similar, with code written in Delphi XE5 compiled to native binaries for Apple or Android device hardware. Other options include Appcelerator Titanium, IBM Worklight and Adobe's open-source PhoneGap, which carries out compilation in the cloud.

News: Adobe Ships Phonegap Build to Simplify Cross-platform DevelopmentAlso: Appcelerator's Titanium Now Comes With Cloud Services

"This is definitely an exciting market, and one that is growing rapidly," Hilwa says.

Embarcadero: Compiling to Native Code Begets Better Performance

So how well do these types of cross-platform tools address the problems suffered by HTML5 and JavaScript? John Thomas, Embarcadero's director of product management, says compiling to native code need not involve a performance hit. With Android, performance may even be enhanced, he says.

"Apple did a great job, and iOS is pretty well-optimized. What we deliver with native code is comparable performance," Thomas says. The story differs with Android because of the way an Android app runs inside a Dalvik VM. "Even with just-in-time compiling, there's a performance hit," he says.

"In addition, the VMs do garbage collection while an app is running, so the performance is non-deterministic," Thomas says. Running ARM code on the CPU, as Embarcadero does, eliminates the need for garbage collection. This improves performance and memory management, he says, "which is fully deterministic and non-invasive."

Single Language Mobile App Dev Offers Productivity Gains

When it comes to coding and maintenance, the whole point of these multi-platform development environments is that they should be easy to use and maintain. For example, Xamarin's use of C# means that it should appeal to Windows developers. Plus, with Visual Studio add-ins, developers can develop Windows, iOS and Android apps from a single, familiar environment.

Related: 9 of the Hottest Mobile Development SkillsAlso: AWS Offers Mobile Developers Cross-Platform Push Notifications

The situation is different for Embarcadero's approach, as Delphi XE5 isn't a standard development language. Thomas maintains that it's easy to learn. "Delphi and C# were developed by the same guy, so basically they are the same language," he says. "It's very easy to make the switch - certainly far easier than adapting to a JavaScript or HTML5 solution."

However, as Gartner researcher Kirk Knoernschild points out, using a multi-platform environment doesn't necessarily mean you can develop for two platforms with the same effort that you would need to develop for one.

"If you want to take advantage of specific platform capabilities, you have to use platform-specific code," he says. "If you're only writing simple apps, you could have one code base - but as soon as you try and leverage exclusive platform features, you can't any more. For a complex app, the most you can hope for is 60 to 80 percent of the code [being] platform-agnostic."

Even if you have to write platform-specific code, Knoernschild says, there are still advantages to using a multi-platform environment: "You're writing in a single language, so there are still productivity gains to be had."

Mobile Apps Built With Cross-platform Tools Aren't Always Pretty

That just leaves the apps themselves - specifically, what they can access and what they look like. Here, there's potential problem when it comes to making apps: The interface elements don't always look exactly the same as true iOS or Android elements.

Feature: 10 Cutting-Edge Mobile Development ToolsMore: 7 Must-Try Mobile Developer Tools

Embarcadero, for example, can call items such as the iOS or Android date picker so that they look identical to those that appear in "normal" iOS or Android apps. But buttons, on the other hand, are drawn to look like iOS or Android buttons without being identical. "Our iOS apps look close to true iOS apps," Thomas says. "There's not the same level of difference as the way that Java apps appear in Windows."

In the consumer space, there's a risk that apps that don't look like true iOS or Android apps simply won't be accepted. That's certainly the view of Dan Sensecall, co-founder of multi-platform mobile app developer TappCandy. "We only develop apps natively, as the end user experience is never the same if you use cross-platform development software like Embarcadero's," he says. "Frankly, the apps it produces look naff. The final quality is never as good."

However, this type of visual differences probably isn't a problem for developers making multiplatform apps for internal enterprise usage. Here the need is to get the functionality "out there," rather than make the app look beautiful, IDC's Hilwa says. "Unlike in the consumer space, enterprises are much more willing to make compromises if they can get more productivity out of their developers, so cross-platform tools are a big deal."

Question Marks for Future of Cross-platform Mobile Dev Tools

It remains to be seen whether cross-platform tools will continue to be a "big deal" in the future. According to Gartner's Knoernschild, open Web technologies such as HTML5, JavaScript and CSS can't be written off just yet.

"As these Web technologies mature, there will be the opportunity to use them to develop cross-platform apps that rival native apps," he says. "Especially for companies that don't need particularly sophisticated features, cross-platform tools will likely face some serious competition from HTML5, CSS and JavaScript in the future."

Paul Rubens is a technology journalist based in England. Contact him at paul@rubens.org. Follow everything from CIO.com on Twitter @CIOonline, Facebook, Google + and LinkedIn.

Read more about android in CIO's Android Drilldown.