evolving mobile architectures

67
Evolving Mobile Architectures Stewart Gleadow http://stewgleadow.com @stewgleadow Martin Fowler http://martinfowler.com @martinfowler

Upload: sgleadow

Post on 19-May-2015

1.543 views

Category:

Technology


2 download

DESCRIPTION

A talk that Martin Fowler and I gave at the Swipe iOS conference in Sydney, September 2012

TRANSCRIPT

Page 1: Evolving Mobile Architectures

Evolving Mobile Architectures Stewart Gleadow

http://stewgleadow.com@stewgleadow

Martin Fowlerhttp://martinfowler.com@martinfowler

Page 2: Evolving Mobile Architectures

http://www.flickr.com/photos/autohistorian/6902804230/

Good products evolve over time

Page 3: Evolving Mobile Architectures

http://www.icehousedesigns.com/webarchive/images/flshbk_COLLAGE2.gif

Remember the early days of the web?

Page 4: Evolving Mobile Architectures

Apps for multiple mobile platforms

Evolving hybrid architectures

Mobile backend systems

Testing hybrid applications

›❯

›❯

›❯

›❯

Page 5: Evolving Mobile Architectures

Apps for multiple mobile platforms

Evolving hybrid architectures

Mobile backend systems

Testing hybrid applications

›❯

›❯

›❯

›❯

Page 6: Evolving Mobile Architectures
Page 7: Evolving Mobile Architectures

✓ Easy to Begin

✓ Good UX

All Native

Page 8: Evolving Mobile Architectures

invest in UX

reuse UX

There is nothing worse than a good mobile application

Page 9: Evolving Mobile Architectures

✓ Easy to Begin

✓ Good UX

✘ Expensive

All Native

Page 10: Evolving Mobile Architectures

✘ Slightly worse UX

✓ Low cost

Cross Platform

Page 11: Evolving Mobile Architectures

Write Once Run Anywhere

Cross Platform

✘ Slightly worse UX

✓ Low cost

Page 12: Evolving Mobile Architectures

Translated UI

Page 13: Evolving Mobile Architectures

Controls Overall UX

Translated UI

Page 14: Evolving Mobile Architectures

Use Native

Mimic

Lowest Common Denominator

Not quite right

Uncanny Valley

Controls

1.

2.

Page 15: Evolving Mobile Architectures

Controls Overall UX

Translated UI

Page 16: Evolving Mobile Architectures

Overall UX

reuse UX

Page 17: Evolving Mobile Architectures

Translated UI

Controls Overall UX

Page 18: Evolving Mobile Architectures

?Cross Platform

Page 19: Evolving Mobile Architectures

?Cross PlatformPortable

Page 20: Evolving Mobile Architectures

Translated UI

Frankenstein UI

Page 21: Evolving Mobile Architectures

Portable Platform

Web App

Page 22: Evolving Mobile Architectures

✗ Worse UX

✗ Missing Features ✗ App Store

✓ App Store

✗ Javascript

Page 23: Evolving Mobile Architectures

UX

low cost

Page 24: Evolving Mobile Architectures

UX

low cost

Hybrid

Page 25: Evolving Mobile Architectures
Page 26: Evolving Mobile Architectures

Separated Presentation

UI Body

✓ Focus ✓ Testing

Page 27: Evolving Mobile Architectures

Portability

HardEasy

Page 28: Evolving Mobile Architectures

Apps for multiple mobile platforms

Evolving hybrid architectures

Mobile backend systems

Testing hybrid applications

›❯

›❯

›❯

›❯

Page 29: Evolving Mobile Architectures

rich experience

responsive

native feel

native features cross platform

technology stack

time to market

cost

being awesome

being realistic

Page 30: Evolving Mobile Architectures

platform coverage

rich experience

Page 31: Evolving Mobile Architectures

platform coverage

rich experience

Laser

Page 32: Evolving Mobile Architectures

platform coverage

rich experience

Cover your bases

Page 33: Evolving Mobile Architectures

Native or web?

Page 34: Evolving Mobile Architectures

using PhoneGap

The Guardian

NATIVE HYBRID WEB

Democracy Now!

BBC OlympicsFacebookLinkedIn

Instagram Jump-in

Page 35: Evolving Mobile Architectures

Victory for native orcover-your-bases in action?

Page 36: Evolving Mobile Architectures

What would we do differently?

Page 37: Evolving Mobile Architectures

Don’t lock yourself into doing everything natively or

everything using the web

andor

Page 38: Evolving Mobile Architectures

Shared presentation using HTML/CSS

Shared logic using Javascript

Sharing between platforms

Page 39: Evolving Mobile Architectures

Objective C Objective C

HTML / CSS Javascript

User Interface Client Logic

iPhone

Mobile Web

Page 40: Evolving Mobile Architectures

Cal

atra

vaObjective C Objective C

HTML / CSS Javascript

User Interface Client Logic

A bridge between native and web

Page 41: Evolving Mobile Architectures

More an approach than a framework

Technology choice per feature

Will soon be open source

Calatrava

http://en.wikipedia.org/wiki/Puente_del_Alamillo

Page 42: Evolving Mobile Architectures

Populating web views from templates: GRMoustache

<div class="person"> <span class=”name”>{{name}}</span>

{{#address}} <div class="address"> {{.}} </div> {{/address}}

... and all the other stuff

</div>

Page 43: Evolving Mobile Architectures

Populating web views from templates: GRMoustache

Should we populate templates on the client or server?

NSDictionary *person = @{ @"name": @"Stew", @"address": @"Melbourne" }; GRMustacheTemplate *template = ...;NSString *renderedContent = [template renderObject:person]; [webView loadHTMLString:renderedContent baseURL:...];

Page 44: Evolving Mobile Architectures

<body onload="window.location = 'myapp://ready'">

- (BOOL)webView:(UIWebView *)webViewshouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{

if ([request.URL.scheme isEqualToString:@"myapp"] && [request.URL.host isEqualToString:@"ready"]) { // We're done, you can display the content now return NO; } ...}

Signal when the UIWebView has loaded

Page 45: Evolving Mobile Architectures

[webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"];

Implementing javascript logic

Inside a UIWebView

Use JavaScriptCore directly?

Page 46: Evolving Mobile Architectures

Cal

atra

vaObjective C Objective C

HTML / CSS Javascript

User Interface Client Logic

So were is this kind of architecture well suited?

Page 47: Evolving Mobile Architectures

Apps for multiple mobile platforms

Evolving hybrid architectures

Mobile backend systems

Testing hybrid applications

›❯

›❯

›❯

›❯

Page 48: Evolving Mobile Architectures

Some expensive and proprietary system

MainframeDatabase

Message Hub

RetailCall Centre

Legacy Thing

Apps are just the tip of the iceberg

Page 49: Evolving Mobile Architectures

App Backend

Page 50: Evolving Mobile Architectures

App BackendAPI

Page 51: Evolving Mobile Architectures

APIApp Backend

How do we build simpler apps and smarter backends?

Product-aligned teams

Principles of REST

Serving data and style

Page 52: Evolving Mobile Architectures

http://www.flickr.com/photos/jakecaptive/3205277810

Forcing logic to the server

What if you could only use NSDictionary objects for your domain model?

Page 53: Evolving Mobile Architectures

Apps for multiple mobile platforms

Evolving hybrid architectures

Mobile backend systems

Testing hybrid applications

›❯

›❯

›❯

›❯

Page 54: Evolving Mobile Architectures

Unit

Integration

UI

Page 55: Evolving Mobile Architectures

Unit

Integration

UI

Kiwi Jasmine

Page 56: Evolving Mobile Architectures

Unit

Integration

UI

Kiwi

Kiwi RSpec

Jasmine

Page 57: Evolving Mobile Architectures

Unit

Integration

UI

Kiwi

Kiwi RSpec

Zucchini

Jasmine

Frank (PublicAutomation)

Page 58: Evolving Mobile Architectures

Testing

Shared business logic

platform-specificmapping

e.g. Frank

e.g. Native-Driver

e.g.Web-Driver

business-levelrequirements client logicUI

Business-levelspecs

Page 59: Evolving Mobile Architectures

Full-Stack and Subcutaneous Testing

Shared LogicAcceptance

Tests

Client LogicUI

Page 60: Evolving Mobile Architectures

Apps for multiple mobile platforms

Evolving hybrid architectures

Mobile backend systems

Testing hybrid applications

›❯

›❯

›❯

›❯

Page 61: Evolving Mobile Architectures

Try out your approach, use short iterations, measure and learn.

Page 62: Evolving Mobile Architectures

UX

low cost

Page 63: Evolving Mobile Architectures

Don’t lock yourself into doing everything natively or

everything using the web

and

Page 64: Evolving Mobile Architectures

UI Body

Separate your presentation from your logic

Page 65: Evolving Mobile Architectures

The app is just the tip of the iceberg

Page 66: Evolving Mobile Architectures

Stewart Gleadowhttp://stewgleadow.com@stewgleadow

Martin Fowlerhttp://martinfowler.com@martinfowler

Evolving Mobile Architectures

Page 67: Evolving Mobile Architectures