44
Totally Build Apps for Free *not really Tony Hillerson • Tack Mobile Mobile+Web DevConf San Francisco January 2015

Totally Build Apps for Free! (not really)

Embed Size (px)

Citation preview

Totally Build Apps for Free*not really

Tony Hillerson • Tack Mobile

Mobile+Web DevConf

San Francisco January 2015

Presentation tackmobile.com

slideshare.net/thillerson/totally-build-apps-for-free-not-really

Presentation tackmobile.com

About Me

• Engineering Director, Tack Mobile

• Denver, CO

• Android (since Beta), then iOS (since ~ iOS 2)

• Various Server-side technologies

• Pragmatic Programmers Author

Presentation tackmobile.com

Goals for Today

• Very Modest Goal:

• Understand what cross-platform solutions get you

• … and what they don’t

• Offer my experience on which types of cross-platform solutions make sense

Presentation tackmobile.com

Like It Or Not…

• Cross platform solutions are necessary

• I don’t like it…

• But it’s the world we live in

• Be prepared

Presentation tackmobile.com

FAQ…

Presentation tackmobile.com

If we use solution ‘X’, then we can build an app for platform Aand get platform BFOR FREE

Presentation tackmobile.com

FOR FREE, RIGHT?

Presentation tackmobile.com

Solutions

• Cordova/Phonegap Based

• Titanium

• Xamarin

• Fuse Tools *NEW!

• React Native *SUPER BRAND NEW!

Presentation tackmobile.com

http://www.gartner.com/technology/reprints.do?id=1-20SX3ZK&ct=140903&st=sb

Presentation tackmobile.com

wut

Presentation tackmobile.com

Presentation tackmobile.com

Presentation tackmobile.com

People Want Answers

Presentation tackmobile.com

Presentation tackmobile.com

Presentation tackmobile.com

First, Let’s Talk About Native

• I strongly believe

Native should be your default preference

Presentation tackmobile.com

Doesn’t HTML Solve Everything?

• Your Mobile Web is important

• A Good Mobile Web Experience is Table Stakes

• Web views replacing native - It’s just not the world we live in yet.

Presentation tackmobile.com

Mobile UX Considerations

• Android users want Android conventions

• iOS users want iOS conventions

• Unless you have a good reason not to

• … and that reason shouldn’t be that you can’t do it with your toolchain

Presentation tackmobile.com

What About These Solutions, Then?

Presentation tackmobile.com

Mobile Development Strategies

• Mobile Web - i.e. no app

• Single Platform - i.e. iOS only

• Multi-platform

• Cross-Platform

Presentation tackmobile.com

What Are You Trying to Accomplish?

• Make a one-size-fits-all app?

• Shield developers from learning a new language or platform?

• Save money on development effort?

• Share code, but still build a great UX?

Presentation tackmobile.com

Cross Platform Strategies

• Web-view solutions

• Vendor Technology/APIs

• Native Compilation

Presentation tackmobile.com

Cross Platform Web

• PhoneGap/Cordova Based

• Strategy: Hide cross platform differences, Write with web technologiesRun in web view

• Hard Questions:

• Does it look like a web app?

• Does it feel like a web app?

Presentation tackmobile.com

Cross Platform Interpreted

• Example: Titanium

• Strategy: Hide cross platform differences behind a common, vendor API.Write everything once with web technologies, interpreted on native platforms

• Hard questions:

• How hard is it to fit design to the platform?

• Do I get native performance and experience?

Presentation tackmobile.com

Cross Platform Native

• Example: Xamarin, React Native, RubyMotion

• Strategy: Unified language and platform to native APIs.Runs in native runtime.Write in one language, calling native APIs.

• Hard Questions:

• Do you trust the developer?

• Can they keep up?

Presentation tackmobile.com

A Syllogism

• Native applications are preferable to web

• and Native execution is preferable to interpreted

• and platform native APIs are preferable to vendor APIs

• Cross platform native apps are native, executed, and access native APIs

• Therefore: Cross native platforms are preferable

• QED

Presentation tackmobile.com

What’s For Free, Then?

Presentation tackmobile.com

React Native Dev Quote

• “We’re not chasing the write once, run anywhere pipe dream”

• “Learn Once, Write Anywhere” 28:50 - http://youtu.be/KVZ-P-ZI6W4?t=28m50s

Presentation tackmobile.com

First, What’s Not Free?

• Platform specific design

• Platform specific expectations

• Technical discovery

• Licensing fees

Presentation tackmobile.com

The Free Part

• Shared code where it makes sense

• Common understanding across team(s)

Presentation tackmobile.com

Cross Platform Native Strategies

• Share http access

• Share local data layer

• Build to MVVM, share model and view model

Presentation tackmobile.com

Cherry-picking Shared Code

API Access Layer +

Deserialization

iOS UIAndroid UI

Presentation tackmobile.com

Push the Shared Code as Far As You Can

API Access Layer +

Deserialization

iOS UIAndroid UI

Common Data Model Layer

Common View Model Layer

Presentation tackmobile.com

Add Caching and Local Data

API Access Layer +

Deserialization

iOS UIAndroid UI

Common Data Model Layer

Common View Model Layer

Local Datastore

Presentation tackmobile.com

Abstract Platform Services

API Access Layer +

Deserialization

iOS UIAndroid UI

Common Data Model Layer

Common View Model Layer

Local Datastore

Location Manager

CoreLocationInjected Injected

Abstract Location Manager

Presentation tackmobile.com

Xamarin as an Example

Presentation tackmobile.com

Xamarin

• Write in C# using .Net libraries

• Access Platform APIs directly

• Core project (shared code)

• Android project

• iOS project

Presentation tackmobile.com

An API Client Interface

public interface CheckvistAPI { [Get("/auth/login.json")] Task<string> LogIn(string username, string remote_key); [Get("/checklists.json")] Task<Checklist[]> GetChecklists(string token);}

Presentation tackmobile.com

iOS Uses It public override void ViewDidLoad () { base.ViewDidLoad (); var client = new CheckvistClient(); var loginTask = new Task(() => { client.LogIn("username", "AP1k3Y"); var checklists = client.GetChecklists(); foreach (var checklist in checklists) { Debug.WriteLine(checklist.Name); } } ); loginTask.Start(); }

Presentation tackmobile.com

Android Uses It protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var client = new CheckvistClient(); var loginTask = new Task(() => { client.LogIn("username", "AP1k3Y"); var checklists = client.GetChecklists(); foreach (var checklist in checklists) { Console.WriteLine(checklist.Name); } } ); loginTask.Start(); }

Presentation tackmobile.com

Recap

Presentation tackmobile.com

Recap

• Web technologies are not up to native standards yet

• Cross platform solutions deserve your attention

• Don’t give up access to the native APIs

• Build good apps