24
CROSS-PLATFORM MOBILE DEVELOPMENT Alexander Shitikov Head of mobile development department

Cross Platform Mobile Development. Business Logic for mobile applications. / Alexander Shitikov (AGIMA.mobile)

Embed Size (px)

Citation preview

CROSS-PLATFORM MOBILE DEVELOPMENT

Alexander ShitikovHead of mobile development department

HYBRID APPLICATIONS

TECHNOLOGIES

BUSINESS LOGIC

Shared logic

for each platform

BUSINESS LOGIC

BUSINESS LOGIC

JAVA AS THE BRIDGE

CHALLENGES

• To create cross-platform mobile business logic library on Java

• To give fully-native interface to developers to interact with it

SOLUTION

• RoboVM

• Objective-C JNI wrapper generator

FEATURES

• Memory management

• Threading

• Namespaces

• Inheritance

• Mapping

• Overloading

• Exceptions

MEMORY MANAGEMENT

• Java object from native

• Native object from java

THREADING

• Control by java

• Control by native

NAMESPACES

java.lang.String -> MTCString

Problem:pl.mobiletrends.String -> MTCString

NAMESPACES

java.lang.String -> java_lang_String

NAMESPACES

java.lang.String -> JavaLangString

NAMESPACES

java.lang.String -> MTCJLString

INHERITANCE AND MAPPING

• class -> @interface

• interface -> @protocol

• boolean -> bool

• byte -> char

• …

• Int[] -> PrimitiveIntArray

• Int[][] -> NSArray<PrimitiveIntArray>

• Object -> MTCObject

INHERITANCE ARTIFACT

public Animal getAnimal() { … }

- (MTCAnimal *)getAnimal;

MTC + Animal.getClass().getShortName()

MAPPING EXAMPLE

public String getTestString() {return “Hello, World!”;

}public int[] getGivenArray(int[] array) {

return array;}

- (MTCString *)getTestString;

- (PrimitiveIntArray *)getGivenArray:(PrimitiveIntArray *)array;

OVERLOADING CHALLENGES

public void overload(int a) {…

}public void overload(int[] a) {

…}

- (void)overload:(int)a;

- (void)overload:(PrimitiveIntArray *)a;

OVERLOADING SOLUTION

public void overload(int a) {…

}public void overload(int[] a) {

…}

- (void)overloadWithAint:(int)a;

- (void)overloadWithAintArray:(PrimitiveIntArray *)a;

EXCEPTIONS

public static void throwException() {

throw new NullPointerException(“MTC 2016”);}

+ (void)throwException;…@try {

[MTCCustomClass throwException]} @catch (MTCNullPointerException *e) {

...} @finally { ... }

PROJECT STATUS

March-April 2016 alpha version

mobile.agima.ru +7 495 981-01-85 [email protected]

THANK YOU FOR ATTENTION!

Alexander ShitikovHead of mobile development department

facebook.com/shitikov.ap