REST Architectural Elements
- REST style is an abstraction of the architectural elements within a distributed hypermedia system.
- REST ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements.
Null Style
- There are two common perspectives on the process of architectural design, whether it be for buildings or for software.
- The designer starts with a blank slate or drawing board and builds-up an architecture from familiar components until it satisfies the needs of the intended system.
- The designer starts with the system needs as a whole, without constraints, and then incrementally identifies and applies constraints to elements of the system in order to differentiate the design space and allow the forces that influence system behavior to flow naturally, in harmony with the system.
- Where the first emphasizes creativity and unbounded vision, the second emphasizes restraint and understanding of the system context.
- REST has been developed using the latter process.
- The Null style is simply an empty set of constraints.
- From an architectural perspective, the null style describes a system in which there are no distinguished boundaries between components.
Client-Server
- The first constraints added to our hybrid style are those of the client-server architectural style.
- Separation of concerns is the principle behind the client-server constraints.
- By separating the user interface concerns from the data storage concerns, we improve the portability of the user interface across multiple platforms and improve scalability by simplifying the server components.
- The significance is the separation that allows the components to evolve independently, thus supporting the Internet-scale requirement of multiple organizational domains.
Stateless
- We now add a constraint to the client-server interaction: communication must be stateless in nature such that each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server.
- Session state is therefore kept entirely on the client.
- This constraint induces the properties of visibility, reliability, and scalability.
- Visibility is improved because a monitoring system does not have to look beyond a single request datum in order to determine the full nature of the request.
- Reliability is improved because it eases the task of recovering from partial failures.
- Scalability is improved because not having to store state between requests allows the server component to quickly free resources, and further simplifies implementation because the server doesn't have to manage resource usage across requests.