Over the past couple of months, my co-workers and I have been watching a video series on Software Craftsmanship, called Clean Coders, by “Uncle” Bob Martin.
The last video we watched was on System Architecture. In this video Bob Martin talked about how presentation patterns like MVC and MVP are part of “delivery mechanisms” of a system architecture and the that business logic should reside in “Interactors” — a higher level controller like class. The group I watched the video with related these interactors to services in a service layer. At a recent usergroup meeting I attended, about UI Presentation Patterns (MVC, MVP, MVVM) the speaker said you should favor light controllers (or presenters) and heavier models (models as in — Db Layer, Repos, Service Layers etc.) — pretty much same thing as Bob said.
- Light Presenters with mainly just calls to service layer?
- Heavier Services with business logic and calls to Repositories?
- Light Repositories with calls to the database?
Uncle Bob is right. Light Presenters are best. Following SOLID, I say that the primary (or Single Responsibility) for Presenters are to provide the interaction between the state of the domain model in whatever form that happens to be (whether you use Repository, or some other business layer, or even just LINQ2SQL, just use your best judgment), and the state of the user interface which provides the Views. Continue reading