- Model :: XHTML
- View :: CSS
- Controller :: JavaScript
Now, it makes sense that CSS is the view. It is the presentation of the data. As most people have seen with the CSS Zen Garden, the CSS can dramatically change the view/presentation of the data. CSS can also do minimal interaction (e.g. :hover). CSS is the view, that seems pretty simple, too.
Now the controller. JavaScript? Yep, I think so. If by JavaScript we take into account the browser itself, JavaScript is "observing" the view by monitoring mouse movements (onhover, onblur, etc.) and many other things as well. The controller then will modify the model (AJAX, modifying innerHtml, etc.). Changes in the model will automatically be reflected in the view (e.g. if JavaScript changes a node's class).
The more I think about it, the more I am satisfied that XHTML + CSS + JavaScript is indeed a simple example of MVC.
No comments:
Post a Comment