4 ms·
Are you talking about pure mvc's like sproutcore? faux mvc's like backbone? model2 patterns like rails and most other server side architectures? I think what yo
by Androsynth 14y ago
Are you talking about pure mvc's like sproutcore? faux mvc's like backbone? model2 patterns like rails and most other server side architectures? I think what you mean is 'Model2 is dead...'. MVC is great for any environment where the observer pattern can be implemented (eg web front-end).
The biggest problems I've seen in model 2 architectures is weak models. The side effect of this is everything gets stuffed in the controllers. This is understandable because there is no observer pattern and therefore the models don't have nearly the power they do in real MVC.
Heres a great explanation of the MVC[1]:
In a nutshell the classic MVC architecture work like this. There is a model that is at the heart of the whole thing. If the model changes, it notifies its observers that a change occurred. The view is the stuff you can see and the view observes the model. When the view is notified that the model has changed, the view changes its appearance. The user can interact with the view (e.g. clicking stuff) but the view doesn’t know what to do. So the view tells the controller what the user did and assumes the controller knows what to do. The controller appropriately changes the model. And around and around it goes.
[1] http://michaux.ca/articles/mvc-architecture-for-javascript-applications http://michaux.ca/articles/mvc-architecture-for-javascript-a...
- revaaron 14y agoMy thoughts exactly. Having used MVC for many years, and in the environment where it was invented (Smalltalk-80), I couldn't help but wonder why he was reinventing MVC while thinking he was criticizing it.
- kenster07 14y agoIn practical terms, those observers would have to live in the controller, or there would be coupling between the model and views.
- Androsynth 14y agoThe observer is supposed to be baked into the framework itself. Theoretically, setting a value on your model will update the view without you having to write any code.