evolving mobile architectures - developer version

45
EVOLVING MOBILE ARCHITECTURES Stewart Gleadow @stewleadow stew@rea-roup.com Thursday, 4 July 13

Upload: sgleadow

Post on 20-Jan-2015

849 views

Category:

Technology


1 download

DESCRIPTION

I've previously given a number of talks on mobile architecture, mostly from a strategy and agility point of view, and one from a technical point of view at Swipe. Here is a slide deck for a version of the same talk I gave but for a developer audience, with a few more code samples.

TRANSCRIPT

Page 1: Evolving Mobile Architectures - Developer Version

EVOLVING MOBILE ARCHITECTURES

Stewart Gleadow@stew!leadowstew@rea-!roup.com

Thursday, 4 July 13

Page 2: Evolving Mobile Architectures - Developer Version

Remember theearly days ofthe web?

http://www.icehousedesi!ns.com/webarchive/ima!es/flshbk_COLLAGE2.!ifThursday, 4 July 13

Page 3: Evolving Mobile Architectures - Developer Version

What’s Jump-in?›❯

Initial mobile architecture›❯

Evolvin! Jump-in›❯

Recommendations›❯

Thursday, 4 July 13

Page 4: Evolving Mobile Architectures - Developer Version

What’s Jump-in?›❯

Initial mobile architecture›❯

Evolvin! Jump-in›❯

Recommendations›❯

Thursday, 4 July 13

Page 5: Evolving Mobile Architectures - Developer Version

77%use another devicein front of the television

Thursday, 4 July 13

Page 6: Evolving Mobile Architectures - Developer Version

Thursday, 4 July 13

Page 7: Evolving Mobile Architectures - Developer Version

Thursday, 4 July 13

Page 8: Evolving Mobile Architectures - Developer Version

Build a small teamthat delivers the product end-to-end.

• Desi!n and product

• Front-end and back-end

• Operations

• (plus anythin! I for!ot)

Thursday, 4 July 13

Page 9: Evolving Mobile Architectures - Developer Version

BUILD

MEASURELEARN

Thursday, 4 July 13

Page 10: Evolving Mobile Architectures - Developer Version

What’s Jump-in?›❯

Initial mobile architecture›❯

Evolvin! Jump-in›❯

Recommendations›❯

Thursday, 4 July 13

Page 11: Evolving Mobile Architectures - Developer Version

How do you build an app that’s undefined and evolvin!?

Thursday, 4 July 13

Page 12: Evolving Mobile Architectures - Developer Version

OR

Thursday, 4 July 13

Page 13: Evolving Mobile Architectures - Developer Version

AND

Thursday, 4 July 13

Page 14: Evolving Mobile Architectures - Developer Version

NATIVE HYBRID WEB

Thursday, 4 July 13

Page 15: Evolving Mobile Architectures - Developer Version

Thursday, 4 July 13

Page 16: Evolving Mobile Architectures - Developer Version

WEB / NATIVEBRIDGE

http://commons.wikimedia.or!/wiki/File:Pont_du_Gard_HDR.jp!Thursday, 4 July 13

Page 17: Evolving Mobile Architectures - Developer Version

Si!nal from web to native

Thursday, 4 July 13

Page 18: Evolving Mobile Architectures - Developer Version

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

Si!nal from web to native

Thursday, 4 July 13

Page 19: Evolving Mobile Architectures - Developer Version

<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; } ...}

Si!nal from web to native

Thursday, 4 July 13

Page 20: Evolving Mobile Architectures - Developer Version

Use protocols to formalise the communication

Thursday, 4 July 13

Page 21: Evolving Mobile Architectures - Developer Version

if ([request.URL.scheme isEqualToString:@"myapp"]) { SEL methodSel = NSSelectorFromString(request.URL.host); struct objc_method_description nativeMethod = protocol_getMethodDescription(@protocol(MyNativeMethods), methodSel, NO, YES); if (nativeMethod != NULL && [self.nativeDelegate respondsToSelector:methodSel] && ![NSObject instancesRespondToSelector:methodSel]) {

// Turn into an NSInvocation and invoke it }

return NO;}

Use protocols to formalise the communication

Thursday, 4 July 13

Page 22: Evolving Mobile Architectures - Developer Version

if ([request.URL.scheme isEqualToString:@"myapp"]) { SEL methodSel = NSSelectorFromString(request.URL.host); struct objc_method_description nativeMethod = protocol_getMethodDescription(@protocol(MyNativeMethods), methodSel, NO, YES); if (nativeMethod != NULL && [self.nativeDelegate respondsToSelector:methodSel] && ![NSObject instancesRespondToSelector:methodSel]) {

// Turn into an NSInvocation and invoke it }

return NO;}

Use protocols to formalise the communication

Thursday, 4 July 13

Page 23: Evolving Mobile Architectures - Developer Version

if ([request.URL.scheme isEqualToString:@"myapp"]) { SEL methodSel = NSSelectorFromString(request.URL.host); struct objc_method_description nativeMethod = protocol_getMethodDescription(@protocol(MyNativeMethods), methodSel, NO, YES); if (nativeMethod != NULL && [self.nativeDelegate respondsToSelector:methodSel] && ![NSObject instancesRespondToSelector:methodSel]) {

// Turn into an NSInvocation and invoke it }

return NO;}

Use protocols to formalise the communication

Thursday, 4 July 13

Page 24: Evolving Mobile Architectures - Developer Version

if ([request.URL.scheme isEqualToString:@"myapp"]) { SEL methodSel = NSSelectorFromString(request.URL.host); struct objc_method_description nativeMethod = protocol_getMethodDescription(@protocol(MyNativeMethods), methodSel, NO, YES); if (nativeMethod != NULL && [self.nativeDelegate respondsToSelector:methodSel] && ![NSObject instancesRespondToSelector:methodSel]) {

// Turn into an NSInvocation and invoke it }

return NO;}

Use protocols to formalise the communication

Thursday, 4 July 13

Page 25: Evolving Mobile Architectures - Developer Version

Runnin! javascript from native code

[webView stringByEvaluatingJavaScriptFromString:@"someFunction()"];

Thursday, 4 July 13

Page 26: Evolving Mobile Architectures - Developer Version

Thursday, 4 July 13

Page 27: Evolving Mobile Architectures - Developer Version

ARCHITECTUREMEANS YOU CAN

RESPOND TO CHANGEFLEXIBILEHAVING A

Thursday, 4 July 13

Page 28: Evolving Mobile Architectures - Developer Version

What’s Jump-in?›❯

Initial mobile architecture›❯

Evolvin! Jump-in›❯

Recommendations›❯

Thursday, 4 July 13

Page 29: Evolving Mobile Architectures - Developer Version

Thursday, 4 July 13

Page 30: Evolving Mobile Architectures - Developer Version

Thursday, 4 July 13

Page 31: Evolving Mobile Architectures - Developer Version

The app is just the tip of the iceber!

Thursday, 4 July 13

Page 32: Evolving Mobile Architectures - Developer Version

App Backend

Thursday, 4 July 13

Page 33: Evolving Mobile Architectures - Developer Version

App BackendAPI

Decouple your app from the backend

Thursday, 4 July 13

Page 34: Evolving Mobile Architectures - Developer Version

App BackendAPI

Force lo!ic to the API, keep the app simple

Thursday, 4 July 13

Page 35: Evolving Mobile Architectures - Developer Version

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

Forcin! lo!ic to the server

Thursday, 4 July 13

Page 36: Evolving Mobile Architectures - Developer Version

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

Forcin! lo!ic to the server

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

Thursday, 4 July 13

Page 37: Evolving Mobile Architectures - Developer Version

How do we build simpler apps and smarter backends?

• Principles of REST• Servin! data and style• Product-aligned teams

Thursday, 4 July 13

Page 38: Evolving Mobile Architectures - Developer Version

Populatin! web views with GRMoustache

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

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

... and all the other stuff

</div>

Thursday, 4 July 13

Page 39: Evolving Mobile Architectures - Developer Version

Populatin! web views with GRMoustache

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

Should be populate templates on the client or the server?

Thursday, 4 July 13

Page 40: Evolving Mobile Architectures - Developer Version

What’s Jump-in?›❯

Initial mobile architecture›❯

Evolvin! Jump-in›❯

Recommendations›❯

Thursday, 4 July 13

Page 41: Evolving Mobile Architectures - Developer Version

CONCENTRATE ON BUILDINGA SIMPLE APP AND A GREAT API

Thursday, 4 July 13

Page 42: Evolving Mobile Architectures - Developer Version

DON’T LOCK YOURSELF INTO DOING

EVERYTHING NATIVELYOR

EVERYTHING USING THE WEB

Thursday, 4 July 13

Page 43: Evolving Mobile Architectures - Developer Version

ARCHITECTUREMEANS YOU CAN

RESPOND TO CHANGEFLEXIBILEHAVING A

Thursday, 4 July 13

Page 44: Evolving Mobile Architectures - Developer Version

Thank you

Thursday, 4 July 13

Page 45: Evolving Mobile Architectures - Developer Version

EVOLVING MOBILE ARCHITECTURES

Stewart Gleadow@stew!leadowstew@rea-!roup.com

Thursday, 4 July 13