Skip to Content


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.

permanent link 19 dec at 13:15 by Matt

There are 11 guest comments so far.

commentat 14:06 on 20 December 2005, Alex wrote:

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.

commentat 17:56 on 20 December 2005, John Sutherland wrote:

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.

commentat 08:04 on 21 December 2005, Alex wrote:

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.

commentat 12:18 on 21 December 2005, John Sutherland wrote:

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.

commentat 07:40 on 22 December 2005, Alex wrote:

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...

commentat 01:45 on 18 June 2007, oku wrote:

oku be :)

commentat 03:03 on 23 June 2007, auelel wrote:

superrrr 546

commentat 03:03 on 23 June 2007, kelie wrote:

super 7897

commentat 03:04 on 23 June 2007, qlqlqikqk wrote:

foooter

good

wqwq

commentat 20:20 on 28 June 2007, toplist wrote:

asdasdsad

commentat 11:35 on 14 July 2007, blog wrote:

bbb

Add a comment:

(required, non-public)

  |  Chars left: 1000

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.


Search the archive

Stylegala news archive

Public news archive

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

Logo design for $149

Advertise here