Developing multi-platform mobile applications: doing it right

ubiquitousstrumpetΚινητά – Ασύρματες Τεχνολογίες

10 Δεκ 2013 (πριν από 4 χρόνια και 21 μέρες)

68 εμφανίσεις

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






Multi
-
platform application does not imply a
single code base,
cross
-
platform

does

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 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














Application code

(should never change)

Platform
-
agnostic
interfaces














Platform
-
specific libraries, “driver”

(vary per platform)

Graphics libraries

Input libraries

Sound libraries

Network libraries

….

Operating system

Recommended architecture (contd.)














Application code

(should never change)

Platform
-
agnostic
interfaces

[action key]

[attack sound]

[attack
]

[reduce hp
]

[update sprite]

[hit sound]














Platform
-
specific libraries, “driver”

(vary per platform)

Multiple code
-
bases


problems














Application code

(written in Java/
Obj
-
C /
Lua

etc.)


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!

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



WebView

UIWebView

BrowserField



HTML / CSS / JS
webpage

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.)

Support

Customization

Performance

Development

Cycle

JQuery

Mobile

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)

Generate a boilerplate Java
project referencing the
generated application code
over JNI

APK
package

Android SDK

Stage I

Stage II

NME
-
based Haxe code

(translate to C++)

C++ code

(compile)

Native library

Haxe

NDK

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

Obj
-

C

Java

C#

JS



Source code in a cross
-
compiled language

Requirements


Adequate tool support & automation


Code quality & performance


Easy debugging & testability


Easy usage of existing software

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




It already features everything you‘ll need


Game and web development


Network communications


Algorithms and data structures


Multimedia libraries


Data format support



haxelib

install
flixel

haxelib

install awe6

haxelib

remove hsl
-
1

haxelib

upgrade

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!