2014 International Conference on Circuits, Systems, Communication and Information Technology Applications (CSCITA)
Multi-platform Strategies, Approaches and Challenges for developing Mobile applications Parag Gokhale
Sachchidanand Singh
Business Analytics Division IBM Software Lab Pune, India
[email protected]
Business Analytics Division IBM Software Lab Pune, India
[email protected] ty across the vendors lends itself to the Web apps. Web apps score high on maintaining same interactions available across Web, Desktop, and Mobile platforms. Thus necessitating fewer changes to data delivery infrastructure. But the Web apps are limited or simply cannot exploit OS features and thus falls short in user experience.
Abstract—Developing applications for mobile platforms is challenging because of multiple proprietary environments. Abundant material has been published discussing three kinds of mobile app development - Native, Web, and Hybrid, where Hybrid apps are preferred due to their usability. In this paper we discuss a strategy and approach for developing and delivering existing Web and Desktop applications as mobile apps. This proposal is a variant of Hybrid development model that utilizes code translators to translate existing Web or Desktop applications for the target mobile platforms. Our goal is to validate if investments made by an enterprise in developing Web or Desktop applications are still relevant when the same are to be re-deployed as mobile apps.
Hybrid apps attempts to bridge this gap between the Native and the Web apps. It uses the power of web delivery and the finesse of Mobile user experience. User interface looks and feels like Native apps and has access to device features like Camera and GPS which are not available to pure Web apps. Each of these development and delivery approaches have pros and cons. But practitioners are favoring Hybrid for all new app developments. Purpose of this paper is to explore whether the Hybrid approach will help developing a mobile version of an existing Web or Desktop applications.
Keywords—Mobile; Multi-platform; Code Translator; Android; iOS; Java 2 CSharp; Tangible Software; User Interface(UI)
I.
INTRODUCTION
While commenting on trends in Enterprise Mobility, an article in Forbes predicted how employees will demand accessing, analyzing enterprise data on their hand-held devices[1]. Mobile users expect same level of interactions like Web or Desktop applications. Enterprises can't delay extending existing Web and Desktop applications to hand-held devices.
II.
Languages like Java, Dot Net have been created to solve the age-old issue of platform independence. In reality, this has not materialized because the run-time environments for these languages are either not available across all platforms or are not optimized to provide satisfactory performance. This is even more evident in hand-held devices. One cannot deploy Java or Dot Net applications on Apple devices because their respective run-time environment does not exist.
Developing Native apps means selecting device specific development platform. Major mobile operating systems iOS (Apple), Android (Google), and Windows (Microsoft) expects apps be developed in Objective-C, Java, and Visual Studio, C# respectively. Unfortunately these development platforms have nothing in common and suggests separate development effort to deliver an enterprise app for each of these platforms.
The three choices discussed frequently for developing mobile applications are Native, Web, and Hybrid apps[2]. All the major mobile operating systems (iOS, Android, Windows, etc.)provide a Software Development Kit (SDK) to develop Native apps using respective, proprietary programming interface. Native apps provide the best possible user experience since it can utilize all of the operating system features.
Web technologies are a strong cross-platform environments. Apps are developed to run in Web Browser environments and can connect to locally or remotely hosted server. Instead of using native code (Java, Objective-C etc.) these apps are developed using HTML, CSS, and JavaScript and JavaScript APIs are consistent across platforms to make them portable without much effort. Although a mobile device user shall have the same interactions available compared to Desktop and Web, it's the most unsatisfying usability experience viewing
Most hand-held devices expecting to run enterprise apps fall in the 'Smart Device' category. Wikipedia defines Smart Devices as devices that generally are connected to other devices or networks via different protocols and as such will definitely have browsers that can connect to internet. This commonali-
978-1-4799-2494-3/14/$31.00 ©2014 IEEE
EXISTING SOLUTIONS
Enterprise users are exceedingly using hand-held devices to conduct their day-to-day professional activities. These activities are no longer restricted to accessing Corporate Emails or reading and creating documents. Business users are demanding ability to access Corporate data stores, create and consume business reports, and reduce the dependency on their physical presence inside Corporate firewall. Vendors are responding by creating powerful mobile development platforms that allow creation of Native, Web, and Hybrid mobile apps.
289
2014 International Conference on Circuits, Systems, Communication and Information Technology Applications (CSCITA)
the content without adjusting for the smaller form factor and without the ability of using device features such as GPS, Camera, etc. Vendors, commercial and Open Source, such as ApplicationCraft, Appcelerator, Rhodes, dragonRAD, RHOMobile, IBM's Worklight and Apache Coardova/Phone Gap provide platforms to build Hybrid apps[3][4][5][6][7][11]. With HTML5 capabilities, differences in the richness of Native and Hybrid apps has reduced significantly. As Gartner rightly notes, the native application development offers the ultimate user experience and performance for mobile applications, the trade-off is often a fragmented set of development tools and multiple versions of an application to serve the same user need – because different versions must be made for each type of device or operating system[8]. However, the promise of HTML5 with offline capabilities and animationrich tools fell short of expectations, causing developers to consider hybrid architectures to better leverage mobile device capabilities[9].
Figure 1: Suggested Architecture
Using above mentioned frameworks and products is a sensible option when developing apps for new initiatives where no functionality has been deployed yet. But what are the options available to enterprises that have applications/products successfully deployed on Desktop and/or Web and are now expecting to deploy the same for Mobile? Expecting these to be redeveloped using above mentioned frameworks and products is intuitively as expensive as developing Native apps.
The User Interface(UI) layer has to be developed separately for each hand-held mobile device such that it can provide device specific gestures to increase user satisfaction. The core app engine is translated to the target platform using open source or commercial translators. C. User Interface(UI) Redevelopment Since UI has to be developed from scratch on each of the mobile platforms, one can use products like Pixate Framework for iOS, which is a free dynamic UI platform for native mobile apps. Similar products exists in the market to develop better UI.
This paper presents a practitioner's view for the enterprise applications, that have good modular design and are successfully deployed on Web and/or Desktop and are now expected to be deployed as mobile apps across maximum mobile platforms. Next sections explain our proposed solution, narration of our experience in implementing a Java Desktop solution on a Windows mobile platform. We conclude with the our assessment of what the exploration achieved and how can it be taken ahead. III.
D. Translators The central theme of this paper revolves around translating business logic to target platform specific language. As discussed earlier, suppose an enterprise already has successfully deployed Web and/or a Desktop application developed in Java and are now expected to deploy this solution as a mobile app. It is expected that the non-UI components be translated into target platform's language(s) Objective-C, C# for deploying a mobile app on Apple and Microsoft mobiles respectively.
ARCHITECTURE
There are two deployment options for hybrid apps on mobile:
Microsoft used to offer an option in Visual Studio 2005 to convert projects created in Visual J++ or Java to Visual C#. They have withdrawn this feature since Visual Studio 2008. An Open Source offering “Java 2 CSharp Translator for Eclipse” [12] has the ILOG translator IBM donated a few years back. Eclipse didn't pursue the proposal to make this project under Eclipse Technology Project, but the binaries for the translator are available under SourceForge and also includes an Eclipse plug-in for easier development. Tangible Software Solutions [13] offers multiple commercial translators between Java and Dot Net languages. Similarly, J2ObjC is an excellent Google project which provides translator for Java to Objective-C. We focused on translating Java to C# targeting Android and Windows Mobile platforms for this paper.
A. LOCAL An app wraps HTML and JavaScript rendering in a manner similar to the structure of a native application. The communication with its server typically uses REST APIs[10]. B. SERVER On the other hand a web application uses built-in browser and the server may detect the client to be a hand-held device and adjust form-factor for its response[10]. Our suggestion is to use the concept of Hybrid apps but running the server locally on the mobile device. The proposed architecture is described below:
290
2014 International Conference on Circuits, Systems, Communication and Information Technology Applications (CSCITA)
Although the rest of the discussion is mainly about translating original Java code to C#, we want to caution the readers that translators of unknown maturity exists from both commercial and open-source vendors. We chose the scenario of existing Desktop application written in Java because deploying it to Android platform would be seamless, no translator required. The only effort required would be to create a native Android UI. IV.
Figure 4: Translator Context Menu in Eclipse Next, we imported the generated C# file in a Visual C# project in 'Microsoft Visual Studio 2010 Express for Windows Phone'. A code change had to be made to GuessingEngine class to get it successfully compiled in VisualStudio. Fig. 5 shows the project structure in Visual Studio.
CASE STUDY
For the purpose of this paper, we used the 'Java to CSharp Translator for Eclipse'. To prove the concept, we developed a simple 'Guess the Number' game in Java. This simple game has just two classes – a UI Class and the Guessing Engine class.
Figure 2: Class Diagram Fig. 2 depicts the relationship between the two classes developed for this game. Invoking startGame() method initializes the GuessingEngine by generating a secrete, positive integer between 0 and 1000.
Figure 5: Visual C# Project Structure Additionally, we created a native UI for Windows mobile. Fig. 6 shows the deployed game on a Windows phone simulator.
Aim of the game is for a user to find this secrete number by making a series of guesses. Each of her guess gets a feedback whether the next guess should be lower or higher. Fig. 3 shows one execution of the game. As you can see, this is Microsoft Window's command line. The Java application is run on a command line.
Figure 3: Command Line Game Execution The 'Java to CSharp Translator for Eclipse' [12] plugin provides a context menu for a Java project as shown in Fig. 4. Figure 6: Windows Phone Execution
291
2014 International Conference on Circuits, Systems, Communication and Information Technology Applications (CSCITA)
V.
and deploy it to the target mobile platform. This is encouraging sign for salvaging previous investments.
CHALLENGES AND FEASIBILITY
We translated 'GuessingEngine' code using two separate translators - “Java 2 CSharp Translator for Eclipse” [12] and “Java to C# Converter” by Tangible Software Solutions [13].
As discussed in Architecture (Section III-C) this approach still expects to develop new, native UI for each of the target platforms. This may not be trivial.
Conversion using Tangible's converter was successful without any errors and we could import it to Windows Visual Studio.
Building reusable UI is possible with tools like PhoneGap. Such UI will work on any mobile platform in their respective browsers but instead of connecting to a remote server it'll be communicating with local copy of the translated server. This approach needs one time investment in developing reusable UI.
Code generated using “Java 2 CSharp Translator for Eclipse” had one compilation error as described below -
An updated architecture is shown in Fig. 7
Original Java code to create an instance of java.util.Random class is: Random random = new Random(System.nanoTime()); Generated C# code is: Random random = new Random((System.DateTime.Now.Ticks*100)); This generated C# statement had to be changed so that Visual Studio 2010 could compile it: Random random = new Random((int)(System.DateTime.Now.Ticks*100)); Following table captures comparison between the two translators: TABLE I. Sr No
1
COMPARISON OF TRANSLATORS
Java to C# Converter by Tangible Software
Java 2 CSharp Translator for Eclipse
Commercial. Free edition can convert up to 1000 lines and code snippet conversion 100 lines at a time
Open Source, Eclipse Public License. No code length limitations
2
No such limitations
Use of ? In generics in body is not supported. Supported in method signature
3
Not integrated with Eclipse IDE
Integrated with Eclipse IDE
Figure 7: Suggested App Development Approach B. Proposal for further work The suggested architecture allows making existing applications mobile ready. The strength of this architecture solely lies on the capabilities and limitations of the translators. This work only attempted to check the feasibility but not the scalability. We would like to take a complex product and apply this architecture to see how well it scales. It is possible to impose certain coding guidelines so that translators work without any issues as well as expect the translators to change for any limitations they may have.
Without fully automated and reliable mechanism to translate any code, the usability of code translators diminishes. Subsequent to above work, we will attempt to convert a fairly large and complex set of Java classes from an open source Android application to a Microsoft Mobile platform (C#). VI.
ACKNOWLEDGMENTS Our thanks to the experts who have contributed towards development of the template.
CONCLUSION
A. Discussion Our aim was to find if investments made in an enterprise's Web or Desktop applications are still relevant when these are to be re-deployed as mobile applications. We were able to translate server side implementation of an existing application
REFERENCES [1] A Look Ahead: Trends Affecting Enterprise Mobility in 2013,
http://www.forbes.com/sites/ciocentral/2012/12/11/a-look-ahead-trendsaffecting-enterprise-mobility-in-2013/
292
2014 International Conference on Circuits, Systems, Communication and Information Technology Applications (CSCITA)
[2] Mobile Application Development, http://www-
[9] Hybrid Approach for Mobile apps,
[3] [4] [5] [6]
[10] Native, HTML5, or Hybrid: Understanding Your Mobile Application
[7] [8]
03.ibm.com/software/products/us/en/subcategory/SWL10 Application Craft, http://www.applicationcraft.com/ Appcelerator, http://www.appcelerator.com/ dragonRAD, http://dragonrad.com/ Rho Mobile,http://www.motorolasolutions.com/USEN/Business+Product+and+Services/Software+and+Applications/RhoM obile+Suite Apache Cardova, http://cordova.apache.org/ Gartner Enterprise Mobility Report, http://www.gartner.com/DisplayDocument?id=1985016&ref=g_nor eg
http://www.gartner.com/newsroom/id/2429815
Development Options, http://wiki.developerforce.com/page/Native,_HTML5,_or_Hybrid:_Und erstanding_Your_Mobile_Application_Development_Options [11] PhoneGap, http://phonegap.com [12] Java 2 Csharp Translator for Eclipse, http://sourceforge.net/apps/mediawiki/j2cstranslator/index.php?title=Ma in_Page [13] Tangible Software Solutions, http://www.tangiblesoftwaresolutions.com/Product_Details/Java_to_CS harp_Converter.html
293