We know that the Database, like the delivey mechanism, should be kept behind boundaries to keep the core of our application clean from those details. So if both are just plugins, then both should be kept behind the same type of boundary. And “we don’t want to cheat and pass Entities or Database rows“ [http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html] through those boundaries.
But when we add the real world and keep it pragmatic, uncle bob tends to soften this boundary to the Gateway and pass Entities right through it, what makes the GatewayImplementation depend directly on the Entities (http://i.stack.imgur.com/Xvlg0.png). So the Entities are passed through this boundary. Probably because it is easier and saves a lot of time (at least in advance). Time that we would otherwise spend on the transfer of properties from an Entity to the according PersistableEntity or whatever we would call that dto.
What I’m actually wondering about is this: why is the gateway-boundary so soft but the presenter-boundary remains? This just seems completely inconsistent to me. If I don’t want the Interactor to know what the Presenter want’s to pass to the View, then I have to pass all the data of my according Entities to the Presenter to let him decide, what is passed to the View. So whatever I am passing to the Presenter (like a PresentableEntity), needs all the information from the Entity making it some kind of Entity-state without the Entity-behavior. This is the same overhead I would have if the Gateway wouln’t know the Entities. And even if I would pass the Entities directly to the Presenter, the View would still know nothing about the Entities because it only depends on the ViewModel which is created by the Presenter. So the Gateway-Plugins and the Presenter-Plugins should be equally decoupled, shouldn’t they?
Is the probability of multiple Gateway implementations lower than the probability of multiple delivery mechanisms? Probably not. Even in the simpliest webproject I would expect two implementaion groups for the Presenter: Web and the unittests (like some FakePresenters) and two gateway implementations: the “real” Database and some InMemoryFake for the tests. And it has often occured to me that multiple types of gateway implementations were used outside the tests: a more portable sqlite version for dev-environments, a full blown daemonized dbms for the staging- and production-environments and maybe some entities (or their state) even have to be sent with SOAP to some extenal service that would for example manage the user data. On the other hand, if my application can be delivered through http/html, cli and some sort of http/json api, then it’s probably done. Another reason the treat both boundaries (to the Gateways and to the Presenters) equally.