Hi all,
This question is a bit rhetorical. At some point i got a feeling that ASP.NET MVC is not that authentic implementation of MVC pattern. Or i didn't understood it.
Consider following domain: electric bulb, switch and motion detector. They are connected together and when you enter the room motion detector switches on the bulb. If i want to represent them as MVC:
switch is model, because it holds the state and contains logic
bulb is view, because it presents the state of model to human
motion detector is controller, because it converts user actions to generic model commands
Switch has one private field (On/Off) as a State and two methods (PressOn, PressOff). If you call PressOn when it is Off it goes to On, if you call it again state doesn't change.
Bulb can be replaced with buzzer, motion detector with timer or button, but the model still represent the same logic. Eventually system will have same behavior.
This is how i understand classical MVC decomposition, please correct me if i am wrong.
Now let's decompose it in ASP.Net MVC way.
Bulb is still a view
Controller will be switch + motion detector
Model is some object that will just pass state to bulb.
So the logic that defines behavior moves to controller.
Question 1: Is my understanding of MVC and ASP.NET MVC correct?
Question 2: If yes, do you agree that ASP.NET MVC is not 100% accurate implementation?
And back to life. The final question is how to separate model from controller in case of ASP.NET MVC. There can be two extremes. Controller does basic stuff and call model to do all the logic. Another is controller does all the logic and model is just something like class with properties that is mapped to DB.
Question 3: Where should i draw the line between this extremes? How to balance?
Thanks,
Andrey