Hello all,
I'm trying to get to grips with the finer points of Model View Controller. I (think I) understand the theory behind it, but when it comes to the dirty work I find myself challenged.
I have a lot of experience with databinding, both in windows forms and web forms. I keep having the feeling that Databinding and MVC are sort of mutually exclusive. My reasoning behind this is thus: one of the points of MVC is that all changes to the model are made by the controller rather than the view. Databinding on the other hand (at least in Windows Forms) is a two-way binding, where changes in the datasource are reflected in the view (good for MVC) but changes in the view are directly channeld to the model (bad for MVC).
I have tried to come up with a "best of both worlds" appreach where I create an explicit datasource class for each control. The control databinds to the datasource class, and the datasource class is in turn the View in MVC. This should also give me the benefit of easily porting from Win to Web and back again - I "only" need to create a version of the control for the appropriate platform and bind it to the same data class.
However, I can't get rid of the feeling that there is something smelly in my code. I hope anybody on this forum can shed some light on this issue. Thanks!
Dirk
I'm trying to get to grips with the finer points of Model View Controller. I (think I) understand the theory behind it, but when it comes to the dirty work I find myself challenged.
I have a lot of experience with databinding, both in windows forms and web forms. I keep having the feeling that Databinding and MVC are sort of mutually exclusive. My reasoning behind this is thus: one of the points of MVC is that all changes to the model are made by the controller rather than the view. Databinding on the other hand (at least in Windows Forms) is a two-way binding, where changes in the datasource are reflected in the view (good for MVC) but changes in the view are directly channeld to the model (bad for MVC).
I have tried to come up with a "best of both worlds" appreach where I create an explicit datasource class for each control. The control databinds to the datasource class, and the datasource class is in turn the View in MVC. This should also give me the benefit of easily porting from Win to Web and back again - I "only" need to create a version of the control for the appropriate platform and bind it to the same data class.
However, I can't get rid of the feeling that there is something smelly in my code. I hope anybody on this forum can shed some light on this issue. Thanks!
Dirk