77
Beyond REST An approach to creating stable, evolve-able Web applications Mike Amundsen @mamund

Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Embed Size (px)

Citation preview

Page 1: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Beyond REST

An approach to creating stable, evolve-able Web applications

Mike Amundsen @mamund

Page 2: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Preamble

• Mike Amundsen • Developer, Architect, Presenter • Hypermedia Junkie

• “I program the Internet.”

• Designing Hypermedia APIs

with Node and HTML5 Fall 2011

Page 3: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Preamble

• Beyond REST • Not “Better than” REST • Not “After” REST • Just “Beyond” REST

Page 4: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Overview

• The Question

Page 5: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Overview

• The Question

• A Few Observations

Page 6: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Overview

• The Question

• A Few Observations

• One Approach

Page 7: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Overview

• The Question

• A Few Observations

• One Approach

• Some Techniques

Page 8: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The Question

Page 9: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

Page 10: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design

Page 11: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement

Page 12: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement distributed network solutions that remain

Page 13: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement distributed network solutions that remain stable

Page 14: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement distributed network solutions that remain stable and flexible

Page 15: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement distributed network solutions that remain stable and flexible over time?

Page 16: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement distributed network solutions that remain stable and flexible over time?

Page 17: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement distributed network solutions that remain stable and flexible over time? Evolvable systems.

Page 18: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

The question is...

How can we design and implement distributed network solutions that remain stable and flexible over time? Evolvable systems.

Page 19: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Few Observations

Page 20: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

Page 21: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

Page 22: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

o "the strength to stand or endure" - Webster

Page 23: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Stability

Page 24: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Stability

Page 25: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

o "the strength to stand or endure" - Webster

Page 26: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

o "the strength to stand or endure" - Webster • Flexibility

Page 27: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

o "the strength to stand or endure" - Webster • Flexibility

o "characterized by a ready capability to adapt to new, different, or changing requirements." - Webster

Page 28: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Flexibility

Page 29: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Flexibility

Page 30: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

o "the strength to stand or endure" - Webster • Flexibility

o "characterized by a ready capability to adapt to new, different, or changing requirements." - Webster

Page 31: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

o "the strength to stand or endure" - Webster • Flexibility

o "characterized by a ready capability to adapt to new, different, or changing requirements." - Webster

• Time

Page 32: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Definitions

• Stability

o "the strength to stand or endure" - Webster • Flexibility

o "characterized by a ready capability to adapt to new, different, or changing requirements." - Webster

• Time

o "a nonspatial continuum that is measured in terms of events which succeed one another from past through present to future." - Webster

Page 33: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Time

Page 34: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Time

Page 35: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Time

Page 36: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

On the scale of years

“Most of REST's constraints are focused on preserving independent evolvability over time, which is only measurable on the scale of years.

Roy Fielding, August 2010

Page 37: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Another way to see it...

Page 38: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Flexible

Page 39: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Stable AND Flexible

Page 40: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Stable AND Flexible Over Time

Page 41: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Alive … Stable

“In short, saying these [patterns] are alive is more or less the same as saying they are stable.”

Christopher Alexander, 1979

Page 42: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

One Approach

Page 43: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Page 44: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

“Design depends largely on constraints”

Charles Eames, 1972

Page 45: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Protocol

Semantics

Page 46: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

• The transfer protocol • HTTP, FTP, etc. • Standardized (RFCs, etc.) • Slowest changing

• Shared by all participants

• Use “as-is” • The stable foundation

Protocol

Semantics

Page 47: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Protocol

Semantics

State

Handling

Page 48: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Protocol

Semantics

State

Handling

Page 49: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

• Identification • Sharing • Storage

• Transient • Unique for each participant

• Create/Manipulate as Needed

• Identify & share via message

• Media type • Headers

• Store locally

State

Handling

Page 50: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Protocol

Semantics

State

Handling

Page 51: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Protocol

Semantics

Domain

Semantics

State

Handling

Page 52: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Protocol

Semantics

Domain

Semantics

State

Handling

Page 53: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

• Application-level semantics • Discover • Encapsulate • Describe

• Shared Understanding • For acknowledged participants

• Evolvable over time

• Message-Enabled

• Media type • Semantic Profile, etc

Domain

Semantics

Page 54: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

A Model

Protocol

Semantics

Domain

Semantics

State

Handling

Connector Data Component

Page 55: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Some Techniques

Page 56: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Connector | Protocol Techniques

• Embrace HTTP as the “network interface” • Methods • Response Codes • Headers • Media types

Page 57: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

This NOT an HTTP Interface

Page 58: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

HTTP Is NOT The Interface

Page 59: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

HTTP Is The Interface

Page 60: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Connector | Protocol Techniques

• Reduce HTTP Impedance Mismatch • Use frameworks that “talk” HTTP • Avoid libraries that hide HTTP

Page 61: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Reduce HTTP Impedance Mismatch

Page 62: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Component | State Techniques

• Honor State Boundaries • Publicly state-less • privately state-ful

Page 63: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

State Boundaries

Page 64: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Component | State Techniques

• Avoid Session Tracking • All you need to share is “who”

Page 65: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

All you need to share is “who”

Page 66: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Component | State Techniques

• Avoid State “Design” Leaking • State belongs to components, not connectors

Page 67: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Avoid Leaking State Design

Page 68: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Data | Domain Techniques

• Avoid Type Marshalling|Object Serialization

Page 69: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Data | Domain Techniques

• Avoid Type Marshalling|Object Serialization • Use Templating Instead

Page 70: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Data | Domain Techniques

• Use MVC Wisely • “Fat” M (not just DB serialization) • “Loose” V (templates, not codecs) • “Decoupled” C (SoC for addressing)

Page 71: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Data | Domain Techniques

• Maximize Hypermedia • State Transfer • Domain Style • App Flow

Page 72: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Data | Domain Techniques

• Model w/ Media Types • Document Media Type, not interactions • Replace RPC designs w/ Media Type designs

Page 73: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Model with Media Types

Page 74: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Summary

Page 75: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Summary

• How can we make implementations more flexible and stable over time?

• Make time your ally • Design “living” systems • Embrace Connector+Component+Data

Model • Adopt techniques that

• Embrace the protocol • Play to strengths in each design element (CCD) • Recognize clear boundaries

Page 76: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Design … Discipline

“Design without discipline is anarchy, an exercise of irresponsibility”

Massimo Vignelli, 2010

Page 77: Beyond REST: An approach to creating stable, evolve-able Web applications (2011-05-13)

Beyond REST

An approach to creating stable, evolve-able Web applications

Mike Amundsen @mamund