7
Implementing a Persistence Adapter
In Chapter 2, What's Wrong with Layers? I complained about a traditional layered architecture and claimed that it promotes database-driven design because, ultimately, everything depends on the persistence layer. In this chapter, we’ll have a look at how to make the persistence layer a plugin to the application layer to invert this dependency.
Dependency inversion
Instead of a persistence layer, we’ll talk about a persistence adapter that provides persistence functionality to the domain services. Figure 7.1 shows how we can apply the Dependency Inversion Principle to do just that:
Figure 7.1 – The services ...
Get Get Your Hands Dirty on Clean Architecture - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.