Monday, September 26, 2005

MVC, a pattern or an architecture?

Is the Model View Controller (MVC) a design pattern, a framework or an architecture? I was having a discussion the other day with all of the developers on our team. We were discussing if the MVC was a pattern, a framework or an architecture? I said it was a pattern, two others said it was an architecture and the third said it was a framework. Being a thorough guy, I set out to prove it was a pattern.
I started out by getting definitions of a pattern, a framework, and architecture. This is best done yourself, but this is what I found;
  • Architecture as defined by the Software Engineering Institute “…is the structure or structures of the system, which comprise software elements, the externally visible properties of those elements, and the relationships among them.”
  • When in doubt, check the wiki. The wikipedia defines a framework as “…a reusable design for a software system (or subsystem). This is expressed as a set of abstract classes and the way their instances collaborate for a specific type of software.”
  • Again, check the wiki. A “… design pattern is a general solution to a common problem in software design. A design pattern isn’t a finished design that can be transformed directly into code; it is a description or template for how to solve a problem that can be used in many different situations.”
So then I went the the “bible”, Design Patterns by Gamma, Helm, Johnson & Vlissides (Gang-o-Four) to see what they said. They referred the MVC as though it was a pattern, they never explicitly said it was a pattern. They said it was a triad of classes and that when you looked inside the MVC there were patterns. So from this I would not say the MVC is NOT a pattern but an architecture. Then of course I’ve been wrong before…