This week's book giveaway is in the Testing forum. We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line! See this thread for details.
Originally I thought the reason was that MVC is a composition of some more basic patterns, such as the observer pattern. But when it is used in web (Model2), observer pattern is not used for the relationship between the model and the view, then which of the 23 GOF patterns do MVC contain? [ September 18, 2002: Message edited by: Da Zhu ]
Couldn't the controller in MVC be interpreted as the command pattern from GOF. Views could be based on Composite- but it varies. Your model- if it uses business delegates- might use Proxy as a basis. I'm just giving some examples here of what MVC could be structured as- I guess it seems to me, that you can structure MVC with a variety of patterns built from GOF.
There's nothing magical about the GOF book. The patterns in it (while extremely useful) are not the ONLY patterns in the world. FAR FROM IT! They are only a few common patterns that the authors happened to decide to document first. There are many, many other patterns just as fundamental as the GOF patterns. In many cases, it's just that the patterns are at a different level. For example, Order-LineItem is a fundamental pattern to doing many types of business systems, but it's not in GOF either (it was, however, discussed in Martin Fowler's "Analysis Patterns"). Likewise, MVC is a fundamental pattern, but it's not of the same level as the GOF patterns -- it's more of an architectural pattern. As such, it was documented in Buschmann's "Pattern Oriented Software Architectures: A System of Patterns" book, which was released at nearly the same time the GOF book was released. Kyle
Originally posted by Matthew Brown: Couldn't the controller in MVC be interpreted as the command pattern from GOF. Views could be based on Composite- but it varies. Your model- if it uses business delegates- might use Proxy as a basis. I'm just giving some examples here of what MVC could be structured as- I guess it seems to me, that you can structure MVC with a variety of patterns built from GOF.
In some implementations (like Struts) Controller objects are, in fact, Commands, but the controller does not have to be implemented with commands. While lots of different implementations of MVC use different GOF patterns, the reason that you can't say "MVC is just X GOF pattern + Y GOF pattern" is that it's not a design pattern -- it's an architectural pattern. You can choose to implement an architecture with an almost infinite number of possible designs. That's where the creativity of software development comes into play. Kyle
The reason being MVC is an architectural pattern rahter than a design pattern. so difference is of level of abstraction. you can divide pattern into three categories 1- Architectrual patterns 2- Design patterns 3- Idioms (code level)
No, you can divide patterns into about a million different categories. The three levels above are a start, but not the end by far. You can have patterns of Software configuration management (for instance in Steve Berczuk's upcoming book), J2EE patterns (John Crupi's book), Analysis patterns (Martin Fowler's book), and nearly anything else you can imagine. Any human endeavor could engender patterns. Kyle