Public news / December 2005 / MVC for the web
MVC for the web
We all know the argument for separating structure, presentation, and behaviour; here's an article relating it the MVC design pattern, and showing how it can benefit those Web 2.0-stylee applications.
There are 11 guest comments so far.
Search the archive
Stylegala news archive
- July 2008 [12]
- June 2008 [46]
- May 2008 [5]
- April 2008 [5]
- March 2008 [3]
- February 2008 [4]
- January 2008 [7]
- December 2007 [3]
- November 2007 [8]
- October 2007 [17]
- September 2007 [12]
- August 2007 [12]
- July 2007 [12]
- June 2007 [11]
- May 2007 [25]
- April 2007 [17]
- March 2007 [19]
- February 2007 [19]
- January 2007 [23]
- December 2006 [15]
- November 2006 [23]
- October 2006 [39]
- September 2006 [29]
- August 2006 [50]
- July 2006 [38]
- June 2006 [29]
- May 2006 [27]
- April 2006 [50]
- March 2006 [38]
- February 2006 [38]
- January 2006 [65]
- December 2005 [45]
- November 2005 [41]
- October 2005 [44]
- September 2005 [46]
- August 2005 [42]
- July 2005 [32]
- June 2005 [36]
- May 2005 [55]
- April 2005 [50]
- March 2005 [37]
- February 2005 [65]
- January 2005 [94]
- December 2004 [61]
- November 2004 [67]
- October 2004 [12]
- September 2004 [1]
Public news archive
- July 2008 [28]
- June 2008 [115]
- May 2008 [126]
- April 2008 [77]
- March 2008 [69]
- February 2008 [80]
- January 2008 [72]
- December 2007 [35]
- November 2007 [54]
- October 2007 [66]
- September 2007 [51]
- August 2007 [65]
- July 2007 [58]
- June 2007 [68]
- May 2007 [87]
- April 2007 [75]
- March 2007 [65]
- February 2007 [62]
- January 2007 [68]
- December 2006 [52]
- November 2006 [51]
- October 2006 [73]
- September 2006 [52]
- August 2006 [85]
- July 2006 [57]
- June 2006 [67]
- May 2006 [103]
- April 2006 [77]
- March 2006 [93]
- February 2006 [99]
- January 2006 [111]
- December 2005 [104]
- November 2005 [83]
- October 2005 [125]
- September 2005 [106]
- August 2005 [94]
- July 2005 [103]
- June 2005 [79]
- May 2005 [79]
- April 2005 [65]
- March 2005 [47]
- February 2005 [35]
- January 2005 [22]
- December 2004 [31]
- November 2004 [37]
News contributors
Features
- Stylegala BookStore
- The Stylegala BookStore has a massive archive of great books for you as a professional..
- Bullet madness
- Bullet madness is a list of 200 bullets, arrows and icons uploaded by our users.
- CSS Reference
- An alphabetical list over the most common CSS1 and CSS2 syntax and properties.
Sponsors

I'm affraid, your description of Model and View are incorrect. The xHTML and CSS are just a part of the View, and are responsible for the final stage of presentation layer.
The Model is supposed to be the layer between DB or DB mapper and the View - it simply contains data or methods in a certain structure.
Different View (template) engines (Smarty, XSL, etc.) can access the Model data and present it to user in a desired format.
Hope that wasn't too confusing.
While you're right (the View of the entire system could be presented using XHTML and CSS), the thinking behind the paper is that the MVC pattern is applied only to the client side. This means that the data (and nothing else) should be in the XHTML, the CSS should be used for style and behaviour should be handled by the JavaScript, rather than mixing the three up.
That hardly makes any sense. What I was saying is that the data (raw data) can be in the Model only, and the Views can access that data and present it in any format needed: xHTML, HTML, WML, XML or even binary for that matter (so CSS may not even be needed).
I'm sorry to say this, but it doesn't seem that you fully understand what MVC is, especially in the context of Web 2.0.
I understand what you're saying Alex, and in general I agree with you. Where we're getting confused (I think) is context. I'm arguing for using the MVC pattern client-side, in which case the XHTML is the raw data. If the XHTML is purely semantic the best case will see the page contain only the raw data and metadata (elements), allowing the XHTML to act as the model, the CSS as the view, and Javascript as the controller.
John, I see your point, however, if the XHTML is the Model (raw data) and CSS is the View then we're stuck with a quite static and not very flexible pattern - the concept of web 2.0 is quite contrary.
Besides, you described the MVC as an OOP pattern, but all of the components in this client-side MVC have hardly anything to do with OOP, though one may argue the case for Java Script...
oku be :)
superrrr 546
super 7897
foooter
good
wqwq
asdasdsad
bbb
Add a comment:
Keep the comment relevant, constructive and be polite.
A valid email address or URL to your site must be provided, or the comment might get deleted. Content seemed inappropriate or offensive may be edited and/or deleted. Avoid explicit language and words such as "sucks" and "ripoff". For more in-depth discussions use our forum. Email addresses are never displayed. Line breaks and paragraphs are automatically converted - no need to use <p> or <br/>. Quotes & apostrophes are automatically converted to smart punctuation. Be careful when copying and pasting portions of entries or other comments. The following inline HTML elements may be used: <strong><em><pre><q><blockquote><code>. All other code will get removed before posting. Don't forget to close your tags.