evolving mobile architectures - developer version
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
EVOLVING MOBILE ARCHITECTURES
Stewart Gleadow@stew!leadowstew@rea-!roup.com
Thursday, 4 July 13
Remember theearly days ofthe web?
http://www.icehousedesi!ns.com/webarchive/ima!es/flshbk_COLLAGE2.!ifThursday, 4 July 13
What’s Jump-in?›❯
Initial mobile architecture›❯
Evolvin! Jump-in›❯
Recommendations›❯
Thursday, 4 July 13
What’s Jump-in?›❯
Initial mobile architecture›❯
Evolvin! Jump-in›❯
Recommendations›❯
Thursday, 4 July 13
77%use another devicein front of the television
Thursday, 4 July 13
Thursday, 4 July 13
Thursday, 4 July 13
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
BUILD
MEASURELEARN
Thursday, 4 July 13
What’s Jump-in?›❯
Initial mobile architecture›❯
Evolvin! Jump-in›❯
Recommendations›❯
Thursday, 4 July 13
How do you build an app that’s undefined and evolvin!?
Thursday, 4 July 13
OR
Thursday, 4 July 13
AND
Thursday, 4 July 13
NATIVE HYBRID WEB
Thursday, 4 July 13
Thursday, 4 July 13
WEB / NATIVEBRIDGE
http://commons.wikimedia.or!/wiki/File:Pont_du_Gard_HDR.jp!Thursday, 4 July 13
Si!nal from web to native
Thursday, 4 July 13
<body onload="window.location = 'myapp://ready'">
Si!nal from web to native
Thursday, 4 July 13
<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
Use protocols to formalise the communication
Thursday, 4 July 13
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
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
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
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
Runnin! javascript from native code
[webView stringByEvaluatingJavaScriptFromString:@"someFunction()"];
Thursday, 4 July 13
Thursday, 4 July 13
ARCHITECTUREMEANS YOU CAN
RESPOND TO CHANGEFLEXIBILEHAVING A
Thursday, 4 July 13
What’s Jump-in?›❯
Initial mobile architecture›❯
Evolvin! Jump-in›❯
Recommendations›❯
Thursday, 4 July 13
Thursday, 4 July 13
Thursday, 4 July 13
The app is just the tip of the iceber!
Thursday, 4 July 13
App Backend
Thursday, 4 July 13
App BackendAPI
Decouple your app from the backend
Thursday, 4 July 13
App BackendAPI
Force lo!ic to the API, keep the app simple
Thursday, 4 July 13
http://www.flickr.com/photos/jakecaptive/3205277810
Forcin! lo!ic to the server
Thursday, 4 July 13
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
How do we build simpler apps and smarter backends?
• Principles of REST• Servin! data and style• Product-aligned teams
Thursday, 4 July 13
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
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
What’s Jump-in?›❯
Initial mobile architecture›❯
Evolvin! Jump-in›❯
Recommendations›❯
Thursday, 4 July 13
CONCENTRATE ON BUILDINGA SIMPLE APP AND A GREAT API
Thursday, 4 July 13
DON’T LOCK YOURSELF INTO DOING
EVERYTHING NATIVELYOR
EVERYTHING USING THE WEB
Thursday, 4 July 13
ARCHITECTUREMEANS YOU CAN
RESPOND TO CHANGEFLEXIBILEHAVING A
Thursday, 4 July 13
Thank you
Thursday, 4 July 13
EVOLVING MOBILE ARCHITECTURES
Stewart Gleadow@stew!leadowstew@rea-!roup.com
Thursday, 4 July 13