


A trivial RESTful API controllerĬonsider this very stripped down, simple controller that pulls the current user and returns a raw Sequelize ORM object as a result of the GetCurrentUser RESTful API call.Ĭool.
ANOTHER LAYER OF INDIRECTION HOW TO
Let me walk you through a real-world example of how to use DTOs - Data-Transfer Objects to introduce stability and protect clients from change in a RESTful API. Since my application depends on the browser, it means I'll always have to keep on top of things the browser does that could cause my app to break. In fact, just this week, I realized that the browsers introduced a new security feature called strict-origin-when-cross-origin that was stopping solidbook.io readers from getting into the online Wiki. A substantial change could break the entire client. It puts the clients in an awkward position of needing to constantly keep on top of the latest changes to the server and protect itself against failure. It means that if, for some reason, the server were to change things or break, that change or breakage has the potential to ripple into each client that relies on it. In this dependency relationship, the clients rely on the server. They have a web, mobile, and desktop app. This usually means that the client relies on the server.Īnd if we're being realistic, it's a lot more likely that there will be several clients that rely on the server (like a web, mobile, and desktop client). Most web applications implement the client-server architecture. This means that components (whether it be a class, object, package, server, or client application) typically rely on other components to do something meaningful.
ANOTHER LAYER OF INDIRECTION SOFTWARE
To understand the concept of indirection, we need to understand the fact that software doesn't do a whole lot unless we can connect things together. I'm not sure about all, but if the structural problems in software design can be reduced to being either an issue with coupling or cohesion, then yeah - this makes a lot of sense. Have you ever heard the expression that " all problems in computer science can be solved by adding another layer of indirection"?
