Slide 1

Slide 1 text

How to Embrace the Browser, Architect’s Edition Stefan Tilkov, innoQ @stilkov enhanceconf London
 4 March, 2016

Slide 2

Slide 2 text

Lessons from the past: CORBA > Once, there was this thing called CORBA > It was supposed to rule the world! > The browser came along, using some stupid text-based protocol > Thank God it got CORBA support! > Everyone was supposed to switch to it …

Slide 3

Slide 3 text

Lessons from the past: WS-* > “We can’t ignore this Web thing anymore” > “Let’s just do RCP over XML and HTTP” > “Port 80 is open, so let’s use it!” > Re-invent IIOP, IDL, CORBA Services as SOAP, WSDL, WS-* > Proprietary integration > Strong vendor support

Slide 4

Slide 4 text

Anatomy of a SOAP “Web service” > Doesn’t expose individual resources with URIs > No links, no forms, no hypermedia > Uses HTTP as a transport > Can’t use advanced HTTP features (e.g. caching) > Specific instead of generic > “Tunnels” through the Web

Slide 5

Slide 5 text

That “REST” thing > Architectural style, defined after the fact > Identification of resources, HatEoAS, self-descriptive messages, representations > Highlighted what contstraints need to be adhered to gain benefits, and what tradeoffs involved are

Slide 6

Slide 6 text

RESTful Web services > Embrace, don’t oppose, the Web’s architecture > Exchange local optimum for benefits of generic approach > Simpler > More efficient > More interoperable

Slide 7

Slide 7 text

What’s the client side analogy?

Slide 8

Slide 8 text

Rendered on Client Rendered on Server Desktop Mobile Set top Web App Native App Frontend, we’ve got frontends Frontend Hybrid

Slide 9

Slide 9 text

Rendered on Client Rendered on Server Desktop Mobile Set top Web App Native App Frontend, we’ve got frontends Frontend Hybrid

Slide 10

Slide 10 text

Assumption: JS-centric web apps can
 be as good as native apps They shouldn’t be as bad!

Slide 11

Slide 11 text

“Web service”1) > Use HTTP as transport > Ignore verbs > Ignores URIs > Expose single “endpoint” > Fails to embrace the Web 1) in the SOAP/WSDL sense “Web app”2) > Uses browser as runtime > Ignores forward, back, refresh > Does not support linking > Exposes monolithic “app” > Fails to embrace the browser 2) built as a careless SPA

Slide 12

Slide 12 text

ROCA: Resource-oriented Client Architecture http://roca-style.org

Slide 13

Slide 13 text

The web-native way of distributing logic Process Flow Presentation Domain Logic Data Server Client > Rendering, layout, styling
 on an unknown client > Logic & state machine on server > Client user-agent extensible via
 code on demand

Slide 14

Slide 14 text

$('.multiselect', context).each(function() {
 $(this).multiselect({
 selectedList: 2,
 checkAllText: "Alle",
 uncheckAllText: "Keinen"
 }).multiselectfilter({label:"",
 width:"200px"});
 });

 Project
 
 DISCOVER
 IMPROVE
 MAGENTA
 ROCA
 ROCKET
 


Slide 15

Slide 15 text

HTML & Hypermedia > In REST, servers expose a hypermedia format > Option 1: Just use HTML > Option 2: Just invent your own JSON-based, incomplete clone > Clients need to be RESTful, too > Option 1: Use the browser > Option 2: Invent your own, JS-based, buggy, incomplete implementation

Slide 16

Slide 16 text

Any sufficiently complicated JavaScript client application contains an ad hoc, informally-specified, bug-ridden, slow implementation of half a browser. (Me, with apologies to Phillip Greenspun)

Slide 17

Slide 17 text

Application Application Application Application > Clients should be modularized as much as servers (cf. μServices) > Browser as platform > How to connect separate UIs?

Slide 18

Slide 18 text

Web UI Integration: Links System 1 System 2

Slide 19

Slide 19 text

Web UI Integration: Redirection System 1 System 2

Slide 20

Slide 20 text

Web UI Integration: Transclusion System 1 System 2

Slide 21

Slide 21 text

Web UI Integration: Web Components? System 1 Component

Slide 22

Slide 22 text

Backend platform goals > As few assumptions as possible > No implementation dependencies > Small interface surface > Based on standards > Parallel development > Independent deployment > Autonomous operations Backend Platform

Slide 23

Slide 23 text

What’s the frontend platform analogy? > As few assumptions as possible > No implementation dependencies > Small interface surface > Based on standards > Parallel development > Independent deployment > Autonomous operations Backend Platform Frontend Platform

Slide 24

Slide 24 text

The browser as a platform > Independent applications > Loosely coupled > Separately deployable > Based on standard platform > Updated on the fly > Any device Backend Platform Frontend Platform

Slide 25

Slide 25 text

How to get away with “just” the Web > Mobile first > Responsive design > Progressive enhancement > Shared assets > Pull vs. push > Sacrifice (some) efficiency Small frontends, loosely coupled

Slide 26

Slide 26 text

Summary

Slide 27

Slide 27 text

The web is more than the sum of its protocols

Slide 28

Slide 28 text

Constraints are good (when architecture is concerned)

Slide 29

Slide 29 text

Embrace the web’s constraints – don’t fight them

Slide 30

Slide 30 text

Stefan Tilkov
 stefan.tilkov@innoq.com
 Phone: +49 170 471 2625 innoQ Deutschland GmbH Krischerstr. 100 40789 Monheim am Rhein Germany Phone: +49 2173 3366-0 innoQ Schweiz GmbH Gewerbestr. 11 CH-6330 Cham Switzerland Phone: +41 41 743 0116 www.innoq.com Ohlauer Straße 43 10999 Berlin Germany Phone: +49 2173 3366-0 Ludwigstr. 180E 63067 Offenbach Germany Phone: +49 2173 3366-0 Kreuzstraße 16
 80331 München Germany Phone: +49 2173 3366-0 Thank you – that’s all I have. @stilkov