Category Archives: System Architecture

System Architecture – UI Patterns, Repositories, Service Layers – What and how much?

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.

That said, I wanted to know how this applied to a project I’m working on which uses a UI Presentation Pattern Framework called WebformsMVP (blogged about this previously here). Inparticular, I wanted to know:
What is the consensus for system architecture with MVP?
  • 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?
So I reached out to the WebFormsMVP GoogleGroup and asked these questions there. Below is a response I got back from one of the users, Alan McBee.
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