Migrated to confluence
REST
Representational State Transfer (REST) is a software architectural style for distributed systems.Roy Fielding has described six constraints that define the REST style, each of which promotes a different set of quality attributes:
Client-Server:
- Requests are initiated by user agents (clients) and ultimately processed by an origin server (server), which provides services through a resource hierarchy
- Why? Decouple client and server. Separation of responsibilities, independent evolution and maintainability
Stateless
- All information needed to understand the conversation state between servers and clients must be included in the request and response message (maybe this why it's called Representational state)
- Why? Enable replication of servers and hence promote availability, scalability; on the other hand, it may decrease performance due to the need for sending the conversational state data embedded in request and response messages.
Cache:
- Cache element acts as a mediator between client and origin server. In multi-tier solutions, a cache may also be present in intermediary tiers.
- Why? Avoid network traffic,
Uniform interface: (central feature that distinguishes REST from other network-based architectural styles)
- Some definitions first:
- Resource: any important concept in the system domain that should be accessible.
- Any Resource is accessible through a Unique identifier (URI) + Method access
- When the Resource is accessed, a Representation of its state is returned (i.e an hypermedia document that brings the state of the resource and links to other associated resources).
- Uniform Interface constraint: representation of a resource must be accessed by a simple interface that defines an identification for the resource and common methods to access.
- Why? Interoperability and Discoverability
Layered system:
- Intermediary tier acts as server to the previous tier and as client to the subsequent tier.
- Why? Elements in an intermediary tier can provide Load-balancing or Caching features
Code on demand (Optional)
- User agent logic can be extended by code received from the server. This is a form of runtime variability since the functionality and behaviour of user agent can vary at runtime per the code received in response messages.
- Why? extensibility, dynamic architecture.
- Interoperability (code handling compatibility among all clients). Security is also a concern to prevent malicious code to reach the clients.
No comments:
Post a Comment