There was been lots of discussion about the MVC pattern in the programming blogs recently. A lot of it has to do with the rise of Rails to bring MVC in the forefront of web development.

What is interesting to me is that while design patterns in general have been looked down upon, somehow MVC is being held up as the “right and only” way of doing UI. There was even a pissing contest of which web framework is the most MVC compliant.

MVC was the name of the GUI framework for Smalltalk, but did you know that the most popular Smalltalk implementation, Squeak doesn’t have it as the default GUI framework? Doesn’t it make you wonder why the originators of MVC moved on to other GUI frameworks like Morphic or Tweak?

I like design patterns, I think gave standard terminology to things people are doing. Unfortunately, one of the pitfalls of having patterns is that people will try to cram patterns into places where it doesn’t fit without understand why it doesn’t fit.

MVC isn’t even a design pattern in the original Gang of Four book. It is described as using a set of design patterns. If a design pattern isn’t an one size fits all solution, how can a set of design patterns describing a larger system be considered inviolable?

Consider this line from the original MVC definition “All these questions and messages have to be in the terminology of the model, the view will therefore have to know the semantics of the attributes of the model it represents.”

Rails does this, since the view has access to the model directly. However, in Cocoa databinding, the view access the data through a binding on the controller. So even if the model’s semantics are different than the view, the controller could act as a bridge between the two.

So which is more MVC?

Be Sociable, Share!