Developing multi-platform mobile applications: doing it right Mihail Ivanchev
Outline Significance of multi-platform support Recommend application architecture Web-based application frameworks Game development frameworks General multi-platform frameworks Cross-compiled languages
Definition: multi-platform application A multi-platform application is a software product a version of which exists for more than 1 platform. Thus, such an application would provide an executable for each supported platform. Multi-platform application does not imply a single code base, cross-platform does
Multi-platform significance More supported platforms imply an increase in the user base, i.e. higher revenue Improved user experience Longer application lifecycle Support of future platforms A mobile application should be efficiently portable to additional platforms.
Mobile applications Main categories Games e.g. social, shooters, racers, puzzles General e.g. shopping, business, communication Many mobile apps serve as front-ends Stand-alone applications vs. web pages
Mobile applications Main categories Games e.g. social, shooters, racers, puzzles General e.g. shopping, business, communication Many mobile apps serve as front-ends Characterized by simplicity and usability Critical factor is the first time usability
Mobile applications Main categories Games e.g. social, shooters, racers, puzzles General e.g. shopping, business, communication Many mobile apps serve as front-ends Characterized by simplicity and usability Critical factor is the first time usability Characterized by specific usage patterns
Recommended architecture Graphics libraries Input libraries Sound libraries Network libraries. Operating system Application code (should never change) Platform-agnostic interfaces Platform-specific libraries, driver (vary per platform)
Recommended architecture (contd.) [action key] [hit sound] [attack] [attack sound] [reduce hp] [update sprite] Application code (should never change) Platform-agnostic interfaces Platform-specific libraries, driver (vary per platform)
Multiple code-bases problems The application is bound to 1 platform Porting requires a reimplementation Porting requires structural changes Porting might require a complete re-design Porting requires an expert for the target platform Maintenance becomes a significant burden You create different applications and your users will notice! Application code (written in Java/ Obj-C / Lua etc.)
Common language Some of the available choices C / C++ supported everywhere Lua supported everywhere JavaScript supported practically everywhere Eqela, Haxe supported everywhere Your decision should be based on the tool support and the performance requirements
Platform-agnostic interfaces Design custom interfaces and provide driver implementations Use existing frameworks Often require a specific programming language Often require a specific environment In general hard to extend with platform-specific code
Multi-platform frameworks Web-based application frameworks PhoneGap, MoSync, iui, QuickConnectFamily Game development frameworks Lua-based, Haxe / NME, Marmalade, Unity 3D General AIR, Appcelerator, DragonRAD, TotalCross
Web-based application frameworks The application is a standard web page accessed locally by a browser component HTML / CSS / JS webpage WebView UIWebView BrowserField
Web-based application frameworks (contd.) Advantages Require little to none platform-specific knowledge Provide clean separation of logic and visuals Allow the usage of all web development tools Allow the usage of all JavaScript libraries Provide a flexible extension mechanism Allow easy debugging
Web-based application frameworks (contd.) Disadvantages Perform slightly worse than native applications Often have longer loading times Cannot easily provide the native look & feel These frameworks allow for very rapid application development, because of the mature environment.
PhoneGap Developed by Adobe Many plugins available Facebook connector Payment providers Camera utilities and barcode scanners Dedicated developer team and community Many successful commercial applications
Mobile look & feel libraries The native look and feel is a critical aspect of usability, but it s hard to implement The alternative is to employ mobile look & feel Sencha Touch Kendo UI JQTouch JQuery Mobile
Mobile look & feel libraries (contd.) JQuery Mobile Support Customization Performance Development Cycle JQTouch Sencha Touch iui Kendo UI Source: own experience & http://www.golen.net/blog/choosing-a-mobile-web-framework
Game development frameworks Lua-based frameworks The application is coded in Lua which run on all mobile platforms The graphics back-end is OpenGL ES Most frameworks are hard to extend Most frameworks provide only simple APIs and just few libraries Examples: Corona SDK, MOAI, Gideros Mobile
Game development frameworks (contd.) Haxe / NME Provides a fully native implementation of the ActionScript API, the heart of Flash Provides a fully automated build process Supports a vast number of libraries and tools Fully free, open source and community-driven Dedicated development team and community Many successful commercial applications
Haxe / NME build process (Android) Stage I (translate to C++) (compile) NME-based Haxe code C++ code Native library Stage II Generate a boilerplate Java project referencing the generated application code over JNI Haxe APK package NDK Android SDK
Game development frameworks (contd.) Other choices Marmalade SDK fully native; integration with other technologies Unity 3D native; tool chain and a game engine; well suited for rapid development of 3D games LibGDX game development middleware Monkey cross-compiled language with a small game development API; easy for beginners, but unsuitable for large-scale projects
General multi-platform frameworks Adobe Integrated Runtime (AIR) wrapped Flash player with extended API Appcelerator JavaScript interpreter and a large API to interact with native components DragonRAD tool chain for building enterprise database-driven applications TotalCross a virtual machine along with a software development SDK
Adobe Integrated Runtime (AIR) Portable Flash player with extended AS3 API allowing interaction with the OS The performance is nearly native due to JIT Permits the usage of all Flash technologies No native look & feel, but quite well suited for multimedia applications and games
Cross-compiled languages Support semantically equivalent syntactical conversion to a set of other languages Source code in a crosscompiled language Requirements Adequate tool support & automation Code quality & performance Easy debugging & testability Easy usage of existing software Obj- C Java C# JS
Haxe an introduction Created by Nicolas Canasse in 2005 Fully open source; ECMA-style syntax Supports C++, PHP, JS, AS3, C#, Java and Neko Multi-paradigm functional and OO Good documentation and many tutorials Tool-supported: FlashDevelop, FDT, Sublime
Haxe library environment Haxe manages the most of its libraries under a common repository haxelib haxelib install flixel haxelib install awe6 haxelib remove hsl-1 haxelib upgrade It already features everything you ll need Game and web development Network communications Algorithms and data structures Multimedia libraries Data format support
Haxe using existing software Provides easy mechanisms to interact with existing software for the target language Externs describe the used library types extern class CustomerAccountManager { public function add(customeraccount acc); public function delete(customeraccount acc); public function issuecreditcard( CustomerAccount acc, CreditCardData dat ); }
Haxe using existing software Provides easy mechanisms to interact with existing software for the target language Externs describe the types of the used library Embedded code use code of the target language if (dlg!= null) { untyped js ("dhtmlx.modalbox.hide(dlg);"); untyped js ("navigator.app.exitapp();"); }
Out of slides Thanks! See y all next year!