mobile apps & apis: best friends forever · 2008 2016 microservices 2010 2012 continuous...

Post on 22-May-2020

9 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Mobile Apps & APIs: Best Friends Forever

Stewart Gleadow @stewgleadow stew@bilue.com.au stewgleadow.com/talks

2008 201620122010

2008 201620122010

greenfields

2008 201620122010

greenfieldsmaintenance/evolution

2008 2016

microservices

20122010

continuous delivery

greenfieldsmaintenance/evolution

TRENDS FOR BACKENDS

BACKEND FOR FRONTEND PATTERN

PRODUCT TEAM STRUCTURES

CHALLENGES & GETTING STARTED

TRENDS FOR BACKENDS

BACKEND FOR FRONTEND PATTERN

PRODUCT TEAM STRUCTURES

CHALLENGES & GETTING STARTED

BIG LEGACY THING

BIG LEGACY THING

BIG LEGACY THING

API

microservices

serverless

serverlesseg. AWS

• S3 • SQS • Lambda

$10 (in stock)

BUY NOW

ADD TO CART

$10 (in stock)

BUY NOW

ADD TO CART

product

$10 (in stock)

BUY NOW

ADD TO CART

product

recommendations

$10 (in stock)

BUY NOW

ADD TO CART

product

favourites

warehouse

checkout

accountpostal

recommendations

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

Mobile apps: slow to develop, update and maintain

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

Mobile apps: slow to develop, update and maintain

Missing features in the API

Rolling out updates takes a long time

Dealing with backwards compatibility

Many requests for simple actions

TRENDS FOR BACKENDS

BACKEND FOR FRONTEND PATTERN

PRODUCT TEAM STRUCTURES

CHALLENGES & GETTING STARTED

Shield your apps from rapidly evolving backends

BACK

END F

OR FR

ONTE

ND

Shield your apps from rapidly evolving backends

BACK

END F

OR FR

ONTE

NDServers and

serverless

CONF

IGURA

TION A

PI

CONF

IGURA

TION A

PI

Static TV Guide

Static TV Content

.NET

node.js

clojure

Backend for frontend characteristics

Stateless, no database

Tuned for larger, cacheable responses

Failure tolerant and scaleable

Aggregate functionality, driven by the experience

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

Chunky vs chatty APIs

Fewer requests with larger responses

Keep responses cacheable

Monitor parsing performance on older devices

PROFILE

SIGN IN

SIGN UP

Hi, Stewart

LOGOUT

PROFILE

POST /register { username: “me”, password: “mine”, }

409 Conflict

PROFILE

SIGN IN

SIGN UP

Hi, Stewart

LOGOUT

PROFILE

POST /login { username: “me”, password: “mine”, }

201 Created Set-Cookie: mytoken=c3Rld0ByZWEtZ3Jvd { token: “c3Rld0ByZWEtZ3Jvd” }

PROFILE

SIGN IN

SIGN UP

Hi, Stewart

LOGOUT

PROFILE

GET /details Cookie: mytoken=c3Rld0ByZWEtZ3Jvd

200 OK { details: { name: “Stewart”, twitter: “@stewgleadow” } }

PROFILE

SIGN IN

SIGN UP

Hi, Stewart

LOGOUT

PROFILE

PROFILE

SIGN IN

SIGN UP

Hi, Stewart

LOGOUT

PROFILEGET /history Cookie: mytoken=c3Rld0ByZWEtZ3Jvd

200 OK { history: [ { item: { … } }, { item: { … } } ] }

PROFILE

SIGN IN

SIGN UP

Hi, Stewart

LOGOUT

PROFILE

POST /register { username: “me”, password: “mine”, }

201 Created Set-Cookie: mytoken=c3Rld0ByZWEtZ3Jvd { details: { name: “Stewart”, twitter: “@stewgleadow” }, history: [ { item: { … } }, { item: { … } } ] }

PROFILE

SIGN IN

SIGN UP

Hi, Stewart

LOGOUT

PROFILE

POST /register { username: “me”, password: “mine”, }

201 Created Set-Cookie: mytoken=c3Rld0ByZWEtZ3Jvd { details: { name: “Stewart”, twitter: “@stewgleadow” }, history: [ { item: { … } }, { item: { … } } ] }

PROFILE

Hi, Stewart

LOGOUT

PROFILE

LOGIN

REGISTER

$10 (in stock)

BUY NOW

ADD TO CART

product

favourites

warehouse

checkout

accountpostal

recommendations

$10 (in stock)

BUY NOW

ADD TO CART

Two requests:

1. All product information 2. Personalised Data

BFFget product

BFF

get core product detailsget product

BFF

get core product details

get other details in parallel

get product

BFF

get core product details

get other details in parallel

return alltransform data

get product

The backend for front end

Fewer requests, simpler interactions

Force logic to the backend

Deal with backwards compatibility

http://www.flickr.com/photos/setaou/2935943672/

TRENDS FOR BACKENDS

BACKEND FOR FRONTEND PATTERN

PRODUCT TEAM STRUCTURES

CHALLENGES & GETTING STARTED

How many BFFs should I have?

How many BFFs should I have?

Treat technology platforms as a product?

Treat separate audiences and feature sets as a product?

BFF

BFF

BFF

BFF

CREA

TORS

LISTE

NERS

platform/core teams

BFF

experience teams

http://www.flickr.com/photos/peternijenhuis/6959653638/

BFF organisational pattern

Split around your concept of a product

People problems trump technology

Product teams own their experience API

TRENDS FOR BACKENDS

BACKEND FOR FRONTEND PATTERN

PRODUCT TEAM STRUCTURES

CHALLENGES & GETTING STARTED

BFF

?

BFF

? caching

BFF

? caching

single-point of failure

BFF

? caching

single-point of failure

duplication

BFF

? caching

single-point of failure

duplication

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

Does this change how you build the apps themselves?

Cross-platform mobile tools become less appealing

Get’s you closer to continuous delivery

API

Getting started

BFF

API

Getting started

BFF

API

Migration strategy

BFF

API

Other solutions

BFF

API

GraphQL

Other solutions

BFF

API

GraphQL

Apigee Mulesoft API Gateway

Other solutions

TRENDS FOR BACKENDS

BACKEND FOR FRONTEND PATTERN

PRODUCT TEAM STRUCTURES

CHALLENGES & GETTING STARTED

Mobile Apps & APIs: Best Friends Forever

Stewart Gleadow @stewgleadow stew@bilue.com.au stewgleadow.com/talks

Questions?

Mobile Apps & APIs: Best Friends Forever

Stewart Gleadow @stewgleadow stew@bilue.com.au stewgleadow.com/talks

REFERENCES• Sam Newman, Pattern: Backends For Frontends: http://samnewman.io/patterns/architectural/bff/

• Stewart Gleadow, Legacy To Mobile First, https://speakerdeck.com/sgleadow/legacy-to-mobile-first

• Software Engineering Daily interview with Lukasz Plotnicki, Moving To Microservices At SoundCloud: http://softwareengineeringdaily.com/2016/02/04/moving-to-microservices-at-soundcloud-with-lukasz-plotnicki/

• Stewart Gleadow, Cameron Barrie, James Brett, Evolving Mobile Architectures @ Mi9: http://www.slideshare.net/sgleadow/evolving-mobilearchitectures

• Lucasz Plotnicki, BFF @ SoundCloud: https://www.thoughtworks.com/insights/blog/bff-soundcloud

• Jan Stenberg, A Pattern For API Backends Serving Frontends: http://www.infoq.com/news/2015/12/bff-backend-frontend-pattern

• Stewart Gleadow, The Next Killer App Is Not An App: https://www.thoughtworks.com/p2magazine/issue02/mobile/

• Martin Fowler, Microservices: http://martinfowler.com/articles/microservices.html

• Sam Newman, Demistifying Conways Law: http://www.thoughtworks.com/insights/blog/demystifying-conways-law

• Michael Feathers, Microservices Until Macro Complexity: https://michaelfeathers.silvrback.com/microservices-until-macro-complexity

• Anthony Green, What Is A Microservice And Why Does It Matter: http://www.brunton-spall.co.uk/post/2014/05/21/what-is-a-microservice-and-why-does-it-matter

• Richard Clayton, Failing At Microservices: https://rclayton.silvrback.com/failing-at-microservices

• Fred George, Microservices Architecture: http://yow.eventer.com/yow-2012-1012/micro-services-architecture-by-fred-george-1286

• Todd Hoff, Microservices Not A Free Lunch: http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html

• Martin Fowler, Strangler Application: http://martinfowler.com/bliki/StranglerApplication.html

• Stewart Gleadow, No App Is An Island: https://speakerdeck.com/sgleadow/no-app-is-an-island

• Sam Newman, Practical Microservices: http://www.slideshare.net/spnewman/practical-microservices-yow-2013

• Jason Goetz, REST API Design: Chunky APIs, Chatty APIs: http://www.jamasoftware.com/blog/rest-api-design/

top related