The year was 1994 when The Gang of Four ( Erich Gamma [twitter] [wikipedia], Richard Helm, Ralph Johnson [wikipedia], and John Vlissides [wikipedia] [person website] ) published Design Patterns - Elements of Reusable Object-Oriented Software [Amazon] which launched the concept of Design Patterns in Software development.
The basic principles of object oriented design are:
- to program to an interface not an implementation
- to make preference of object composition over inheritance
In a simple definition... a design pattern is not merely a class, or a library, that can simply plug into structure. It is a template that has to be implemented in a situation. It's also not language-specific. A good design pattern should be implementable in most, if not all, languages depending on the capabilities of the language.
There are three basic kinds of design patterns:
- Structural - deals with relationships between entities
- Creational - provides instantiation mechanisms (object creation)
- Behavioral - used in communications between entities
The adapter pattern is a structural design pattern that allows you
to repurpose a class with a different interface, allowing it to be used
by a system which uses different calling methods.
more structural design patterns
The factory method pattern is a creational design patten.
It's a class that acts as a factory of object instances.
more creational design patterns
The strategy pattern is a behavioral design pattern that allows you
to decide which course of action a program should take, based on a
specific context during runtime. You encapsulate two different algorithms
inside two classes, and decide at runtime which strategy you want to
more behavioral design patterns
Somewhere out there on the vast Internet I once read that the MVC can be metaphorically related to your home TV. You have various channels, with different information on them supplied by your cable provider (the model or the data). The TV screen displays these channels to you (the view or the user interface). Then theres the electronic mechanism in the TV that switches channels (the controller or director).
That metaphor makes sense to me and at a high level view it describes
the MVC pattern accurately.
HMVC can be a structural, creational, behavorial, or a mixture of
of the three design pattern categories. It is an evolution of the MVC
pattern used for most web applications today. In fact think of as more
of a MVC 2.0 approach. HMVC came about as an answer to the salability
problems apparent within applications which used MVC
JavaWorld July 2000
It was proposed that the standard Model, View, and Controller triad
become layered into a "hierarchy of parent-child MCV layers".