What's the best breakdown of responsibility when utilizing an online power grid and also the MVP pattern inside a winforms application.
- Getting callbacks in the power grid on user transformed cell updates
- Callback in the power grid to create the design and style and worth of a cell given a row and column
The precise duties within the many designs which are known to as Model-View-Presenter vary. Mainly they vary about how exactly much control is exerted within the view through the presenter. Martin Fowler comes with an thorough discussion of a variety of variants in the chapter on GUI Architectures, it's really worth a read.
Take a look at Presenter First because it handles plugs and also the duties in certain depth.
model (or domain model) == logical representation from the organizations active in the system including their condition and behavior
presenter == listen for occasions from view (and perhaps model) and repair individuals demands, convert model types into view types (passive view), this is actually plumbing to cover the vista and also the model from one another. Responds to stimulus in the user.
view == presentation: the visual representation from the model the user can connect to, collecting user input
Your particular questions round the callbacks and becoming the power grid cell style are generally likely to involve the vista handling occasions from power grid and raising occasions to the presenter to request actions or retrieve data in the model. This is ideal for the callback once the cell submissions are up-to-date (this must be released towards the presenter to ensure that the presenter can validate the modification within the model making the modification within the model).
For that power grid cell style I'm convinced that some kind of adapter within the view might need to translate the condition in the model (retrieved with an event in the view towards the presenter) in to the power grid cell style information. This may take place in the presenter however i would personally like the presenter not have understanding from the widget within the view.
Basically understand you properly, the power grid is area of the view implementation and isn't visible towards the presenter. For the reason that situation, the presenter shouldn't have to know the way the information is displayed, only how you can provide them.
I'd most likely produce a assistant class, an adapter of some kind, that the power grid conveys with. The power grid sees only this assistant, ditto for that view.
The collaboration could be something similar to:
power grid <-- assistant <-- view <--> presenter