Dependency Inversion
Figure 6.1 gives a zoomed-in view of the architecture elements that are relevant to our discussion of a web adapter – the adapter itself and the ports through which it interacts with our application core:
Figure 6.1 – An incoming adapter talks to the application layer through dedicated incoming ports, which are interfaces implemented by the domain services
The web adapter is a “driving” or “incoming” adapter. It takes requests from the outside and translates them into calls to our application core, telling it what to do. The control flow goes from the controllers in the web adapter to the services in the application layer.
The application layer provides specific ports through which the web adapter may communicate. Each port is what I have called a “use case” in the previous chapter, and it is implemented by a domain service in the application layer.
If we look closer, we...