Benefits of REST

The REST constraints were designed with separation of concerns and forward-compatibility in mind, and this design allows for the individual components of REST to evolve without compromising the underlying architectural style itself.

By enforcing the constraints of REST, some particular architectural properties are exposed that reveal the beneficial nature of this architectural style. Let's explore some specific benefits of REST more closely.

Performance

Performance is a major benefit of REST, and it is exposed by using cache, simple representations such as JSON, a layered system with multiple servers and load balancing, and the decoupling of components through a uniform interface.

Simplicity

Simplicity is another key benefit of REST, and it is primarily exposed by the uniform resource constraint in which individual components of the system are decoupled. Simplicity is also seen in the server component, which needs only to support HTTP requests, and does not have to support state for any request.

Separation of concerns

Separation of concerns lends to the simplicity of REST, but is also a benefit itself. This is seen in the separate server-client relationship, the burden of caching being put on the frontend, and the use of a layered system. Separation of concerns is a common pattern seen not only in architecture but in software design as well, such as the MVW architectural patterns discussed in Chapter 2 , Model-View-Whatever.

Scalability

The architectural property of scalability is exposed in REST through the simplicity of the client-server relationship and the separation of concerns properties. By combining these key attributes, the system becomes more scalable because the complexity of relationships between the components is reduced by having specific guidelines around how they should work together.

Portability

Portability is a benefit of REST that is exposed through the client-server separation of concerns. This allows the user interface layer of the application to be portable because it is agnostic of the underlying server software being used to host the REST endpoints.

Portability is also exposed through code-on-demand, giving REST the ability to transport application code from server to client.

Visibility

Visibility simply refers to the ability to understand what is happening in a system based on the components' interactions with each other. With REST, high visibility is a benefit because of the decoupled nature of components and the fact that they need little to no knowledge of each other. This allows interactions made within the architecture to be easily understood, such as requests for endpoints. To determine the full nature of a request, one need not look beyond the representation of that request itself.

The code-on-demand constraint of REST is one that actually reduces visibility, but for this reason, it is optional. In following, code-on-demand is not often used by modern-day web applications, aside from simple JavaScript widgets that are found on web pages and used for advertising, social networks, and other third-party interactions.

Reliability

Reliability is a benefit of REST that is exposed primarily through the stateless server constraint. With a stateless server, a failure in the application can be analyzed at the system level because you know that the origin of that failure is from a single, decoupled component of the system.

For example, if you receive an error message in the UI for a web application that indicates to the user that information was entered incorrectly, then this failure can be handled at the UI level. If, on the other hand, you receive a HTTP 400 response code error from the server after entering the correct information, you can further deduce that the REST server endpoint is not configured correctly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.51.145