REST: The Architectural Style of the Web
REST is a set of design rules, not a strict protocol, for building massive distributed systems like the web. These constraints enable independent component deployment, scalable interactions, and a layered architecture that supports caching and security.
WHY IT EXISTS: The World Wide Web needed a guiding architectural philosophy to manage its immense scale and complexity. REST was created to provide that guide, defining a set of rules for how a distributed, Internet-scale system should be designed to ensure it can grow, evolve, and remain stable.
THE MENTAL MODEL: Think of REST not as a specific technology or protocol, but as an architectural style—a design philosophy. It's like the set of zoning laws and building codes for a city. These rules don't specify what each building must look like, but they ensure that all buildings can coexist, that utilities can connect to them, and that the city can grow in an orderly fashion.
HOW IT WORKS: REST works by enforcing constraints that produce a desirable system architecture. It emphasizes a uniform interface so all components communicate in a standardized way, simplifying the system. This allows for independent deployment, where clients and servers can evolve separately. The style is designed for scalability of interactions, allowing the system to handle massive growth. Finally, it promotes a layered architecture, where intermediaries can be placed between clients and servers to handle tasks like caching to reduce latency or enforcing security rules.
WHEN TO USE IT: Apply REST principles when designing distributed systems that need to operate at a large scale, especially over the internet. It is the foundational style for the modern web and is ideal for building public APIs that need to be long-lasting, scalable, and accessible from a wide variety of clients. The goal is to create a system where components are decoupled and can evolve independently.
WHEN NOT TO USE IT: The constraints of REST may be unnecessary overhead for systems that are not distributed or do not require massive scale. For example, in a monolithic application where components communicate within the same process, the benefits of decoupling and layering are less critical. If your components are tightly coupled by design, a simpler communication style may be more appropriate.
ONE CANONICAL EXAMPLE: The World Wide Web is the ultimate example of a RESTful system. A web browser (client) requests a resource from a web server using a uniform interface (HTTP). Intermediaries like caching proxies and Content Delivery Networks (CDNs) can exist in layers between them to improve performance, and the browser doesn't need to know they are there. This architecture has allowed the web to scale to billions of users and servers.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.