I’m studying Clean Architecture, and I came across a technical concept in the diagram from chapter 8. In this chapter, the author states that the Financial Data Mapper implements the Financial Data Gateway and interacts with the Financial Database.
However, this left me a bit confused. To me, it doesn’t make much sense for a Data Mapper to interact directly with the database. I’ve always understood the role of the Mapper as simply translating between the application’s objects and the database model (and vice versa), without performing read or write operations on the database.
Another point that puzzled me is the idea of a Mapper implementing the Gateway. Why not use a repository instead? I can’t wrap my head around a Mapper being responsible for database communication.
It’s possible that I misunderstood this part, so I apologize if my question or understanding seems naive. I also understand that the diagram’s purpose is to illustrate the OCP principle rather than detailing a practical implementation. Still, since the diagram provides an interesting high-level view of how a feature works, I decided to use it for study purposes.
