Why grouping Design pattern in three parts?
Design pattern can separate 3 important parts. Why three part?
- Creational Patterns
- Structural开发者_Go百科 Patterns
- Behavioral Patterns
How can I separate it into three parts? According to what?
Suggest you get a copy of the Gang of Four book that introduced (and explains) this classification.
+1 to get Gang of Four.
Also bear in mind that these are basic classic patterns. And the division is done based on how and for what patterns can be used. Like you can see description in Wikipedia.
Creational patterns patterns have to do with class instantiation. They can be further divided into class-creation patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, object-creation patterns use delegation to get the job done.
Structural patterns concern class and object composition. They use inheritance to compose interfaces and define ways to compose objects to obtain new functionality.
Behavioral patterns Most of these design patterns are specifically concerned with communication between objects.
You can also have Concurrency pattern, Enterprise Integration Patterns, Distributed design patterns, etc...
On the website, the design patterns are grouped according to their function. Design patterns which have to do with creating objects are called "Creational Patterns", patterns having to do with classes interfacing with each other are called "Structural Patterns" and other patterns are called "Behavioral patterns". I don't know if these are official groupings or that the website made these up.
Those patterns are in those categories because of they share specific attributes (ie. some create stuff, some structure stuff, some influence the behaviour of stuff). This doesn't affect the usage in your code however.
DoFactory.com is a good place to start.
精彩评论