How does this help me build maintainable software?
When building a web adapter to an application, we should keep in mind that we’re building an adapter that translates the HTTP protocol to method calls on the use cases of our application, translates the results back to HTTP, and does not do any domain logic.
The application layer, on the other hand, should not do HTTP, so we should make sure not to leak HTTP details. This makes the web adapter replaceable with another adapter should the need arise.
When slicing web controllers, we should not be afraid to build many small classes that don’t share a model. They’re easier to grasp and test, and they support parallel work. It’s more work initially to set up such fine-grained controllers, but it will pay off during maintenance.
Having looked at the incoming side of our application, we’ll now take a look at the outgoing side and how to implement a persistence adapter.