Legacy code is both an opportunity and a challenge. The opportunity exists if it’s possible to reuse the code to save time on future projects or to take an existing app into new markets. The challenge is that the code is often in a format that hinders that.
This isn’t a new phenomenon. It dates back to the start of the mass market games industry, when the same game would often be written twice from scratch for the Commodore and the Spectrum home computers. The market moves quickly today, though, and developers need to find effective ways to make their past code pay its way.
Many developers have created apps using Objective-C to target Apple iOS devices, such as the iPhone and the iPad. The problem is that this code is very specific to those devices, and cannot be used directly when developing apps for the Ultrabook, Android devices, or other non-Apple devices.
Developers want to have a presence on as wide a range of platforms as possible, to increase brand awareness and revenues and squeeze out competition, but it can often feel like they’re rewriting the same game over and over again, which is mind-numbingly boring.
Now, there is a new solution to this problem in the shape of a tool from Intel, currently in beta, called the Intel HTML5 App Porter Tool.
HTML5 represents an opportunity because it’s supported across a wide range of different devices and operating systems, so it enables the same code base to be reused across different app deployments. The new Intel tool takes your Objective-C code and automatically turns it into HTML5, as far as possible.
Specifically, it does the following:
• Layouts of views inside Xcode Interface Builder (XIB) are converted into HTML pages with associated CSS.
• Xcode project files are converted into Microsoft Visual Studio 2012 projects.
Where the tool cannot convert an iOS API call into HTML5, it creates placeholder code and annotates it, including the type of arguments passed to it and expected in return, and where the function is referenced in the program. Developers can focus their attention on these routines, then, rather than spending time on converting code that can be easily translated automatically.
Navigating the new code should be easy: function and variable names are preserved as in the original code, and filenames are preserved as far as possible (although file extensions are likely to change).
The translated code uses standard HTML5 and augments it where necessary with jQuery Mobile and the Intel HTML5 App Porter Tool library, which provides a thin layer to implement functionality not supported in those libraries.
Intel plans to add support for more iOS APIs over time, and will carry out statistical analysis of the most popular APIs and seek feedback to decide where to direct its efforts.
For a complete breakdown of how the tool works, see the technical reference guide. To download the tool, visit the Intel Developer Zone HTML5 community and click on the Tools tab.
This blog post is written by Softtalkblog, and is sponsored by the Intel Developer Zone, which helps you to develop, market and sell software and apps for prominent platforms and emerging technologies powered by Intel Architecture