I get to work with a number of companies, mostly with architects/lead developers and sometimes directly with the developers. One thing that comes up often is that when architects prescribe an application pattern, they want it to be followed consistently every time with little to no room for variation.
Presentation Model/M-V-VM
A good example of this is the Presentation Model (M-V-VM) pattern. When I think of this pattern, I think of it as "we have an object model to represent the state and behaviors of the current scenario, and a view object that surfaces it to the UI". In my mind, the things representing the state (the model/view model) is more conceptual than a prescriptive guide. A view might use many objects to represent this state, or it might use one, or perhaps it is so simple that it needs none, or perhaps it shares one. The ethos of the pattern is that we seperate the state management from the visualization code.
However, often what I come across is the patterns being intepreted much more literally. A typical project might look like this:
- Views
- Foo
- FooView.xaml
- FooView.xaml.cs
- FooViewModel.cs
- FooModel.cs
- Bar
- BarView.xaml
- BarView.xaml.cs
- BarViewModel.cs
- BarModel.cs
- Foo
Sometimes, the Model object is empty, or the ViewModel is just forwarding property getters/setters to the model object. Sometimes the view is so simple, that the extra objects just make it more complicated than it needs to be.
As architects/team leads, do you prefer developers follow the same process every time like a checklist? Or do you prefer to leave the details up to the developers?