29
Roy Fielding’s PHD Dissertation Chapter’s 5 & 6 (REST)

Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Roy Fielding’s PHDDissertation

Chapter’s 5 & 6 (REST)

Page 2: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Architectural Styles andthe Design of Network-

based SoftwareArchitectures

Roy FieldingUniversity of California - Irvine

2000

Page 3: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Chapter 5

Representational State Transfer(REST)

Page 4: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Deriving REST

Walkthrough of the process of deriving rest

Two Perspectives on Architectural Design

Blank Slate

Whole System Needs

Emphasizes Restraint and System Context

REST

Page 5: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Starting with the Null State Null State is the system

without constraints The WWW is the Null

state for REST No distinguishing

boundaries betweencomponents(architecturally)

Page 6: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Client - Server Constraints

Separation of Concerns User Interface vs. Data Storage Improves portability and scalability Allows components to evolve independantly

Page 7: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Statelessness Communication must

be stateless Session state kept

entirely on client Improves:

Visibility Reliability Scalability

Design Trade-offs Possible decrease in

network performance Reduces server control

over application behavior Depends on correct

implementation ofsemantics acrossmultiple clients

Page 8: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Client - Stateless - Server

Page 9: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Caches Requires data

responses to be labledcacheable or not

Improves Network efficiency Reduces average latency

Design Trade-offs Can reduce reliability

Stale data Major changes in the

server not updated inthe cache

Page 10: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Client-Cache-Stateless-Server

Page 11: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

State of the Early Web Web pre-1994 Developers quickly

exceeded early design Dynamically generated

responses Server-side scripts

Page 12: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Uniform Interface Distinguishes REST from

other network based styles Implementations decoupled

from services Additional Constraints

Identification of resources Manipulation of resources

through representations Self-descriptive messages Hypermedia as the engine

of application state

Design trade-offs Degrades efficiency

Information is not in aform specific to theapplication

Designed to work well forthe Web (large-grain)hypermedia data transfer May not be optimal for

other situations

Page 13: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Uniform-Client-Cache-Stateless-Server

Page 14: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Layered System Adds hierarchical layers

Creates a bound onoverall systemcomplexity

Promotes substrateindependence

Provides encapsulation Improves Scalability

Load balancing

Design Trade-offs Adds overhead and

latency to the processingof data increasing userperceived latency This can be mitigated

with shared caches onorganizationalboundaries

Page 15: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Uniform-Layered-Client-Cache-Stateless-Server

Page 16: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Code-On-Demand

Optional Constraint Allows extension of client functionality

Reduces the number of pre-implemented features Improves system extensibility

Trade-off Reduces visibility

Page 17: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

REST

Page 18: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

REST Derivation byConstraints

Page 19: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

REST Architectural Elements

REST focuses on The roles of components Constraints upon component interaction Component’s interpretation of significant data

elements

Page 20: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Data Elements

The nature and state of data is a key aspectof REST

REST uses a shared understanding of datatypes with metadata, but limits the scope ofwhat is revealed to the interface

Components communicate by transferring arepresentation of a resource

Page 21: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Data Elements

Page 22: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Resources and ResourceIdentifiers

Any information that can be named can be aresource Resource R is a temporally varying membership

function M R(t), which for time t maps to a set ofentities, or values, which are equivalent

A resource identifier is chosen to best fit thenature of the concept being identified

Page 23: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Representations

A representation is a sequence of bytes plusrepresentation metadata

May also include resource metadata Information about the resource not specific to the

representation Data format of a representation known as a

media type Design of a media type may influence user

perceived latency

Page 24: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Connectors

Encapsulate the activities of accessingresources and transferring resourcerepresentations Provide clean separation of concerns Provide substitutability by hiding implementations

and allowing them to be replaced Remember REST is stateless

Page 25: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Connectors

Page 26: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Components

Page 27: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Process view of REST

Page 28: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Connector View of REST

The mechanics of communication Clients examine resource identifier in order to

determine communication mechanism REST does not restrict communication protocol

Page 29: Roy Fielding’s PHD Dissertation · Architectural Styles and the Design of Network-based Software Architectures Roy Fielding University of California - Irvine 2000. Chapter 5 Representational

Data View of REST

Control state concentrated into therepresentations received in response tointeractions Steady state reached when there are no more

outstanding requests Application state stored and controlled by the

user agent