Design Patterns: From Analysis to Implementation by
This is an excerpt from the manuals for Design Patterns Explained: A New Perspective for Object-Oriented Design Not all of the Gang of Four design patterns are included because not all of them are covered in the course. Furthermore, we use a variation on the classification of the GoF patterns: The Decorator and Proxy patterns are classified as Structural patterns by the GoF. Since they both add instead of just combining functionality, I believe they are more behavioral in nature. In our minds, the Bridge can be considered as either a Structural or Behavioral pattern. As a structural pattern, it allows the use of two different, given, implementation in the same way. As a behaviorally pattern, it helps identify that there are variations of an implementation. We have also reclassified several Behavioral patterns as Decoupling patterns (a new classification of ours). That is because these patterns are more about decoupling than about managing new behavior.
This is a work in progress. Updates will be announced through our e-zine. You can subscribe to this by sending a message to firstname.lastname@example.org and putting subscribe in the subject. Contents: Abstract Factory* Builder Factory Method* Object Pool* Prototype Singleton* Adapter* Bridge* Composite* Façade* Proxy – Virtual* Decorator* Proxy – adding function* State* Strategy* Template Method* Visitor Chain of Responsibility* Iterator* Mediator* Memento Observer* Proxy – accessibility* Model-View-Controller
* Along with the Analysis Matrix, these are considered minimal competencies for software developers by Net Objectives
© 2007 Net Objectives, Inc. All Rights Reserved
Design Pattern Matrix
CREATIONAL PATTERNS Notes on the patterns A b s t r a c t B u i l d e r F a c t o r y O b j e c t P r o t o t y p e S i n g l e t o n F a c t o r y Indicators in analysis: Different cases exist that require different implementations of sets of rules. Indicators in design: Many polymorphic structures exist that are used in pre-defined combinations. These combinations are defined by there being particular cases to implement or different needs of client objects. Indication pattern is not being used when it should be: A variable is used in several places to determine which object to instantiate. Relationships involved: The Abstract Factory object is responsible for coordinating the family of objects that the client object needs. The client object has the responsibility for using the objects. Principle manifested: Encapsulate construction. Indicators in analysis: Several different kinds of complex objects can be built with the same overall build process, but where there is variation in the individual construction steps. Indicators in design: You want to hide the implementation of instantiating complex object, or you want to bring together all of the rules for instantiating complex objects.
Indicators in analysis: There are different commonalities whose implementations are coordinated with each other.
M Indicators in design: A class needs to instantiate a derivation of another class, but doesn’t know which one. Factory method e allows a derived class to make this decision. t Field notes: The Factory method is often used with frameworks. It is also used when the different implementations of one class h hierarchy requires a specific implementation of another class hierarchy. Note that a factory method pattern is not simply a method that serves as a factory. The pattern specifically involves the case where the factory is varied polymorphically. Factory Method is o also very useful when unit testing with Mock Objects. d Principle manifested: Encapsulate the relationship between class hierarchies. Indicators in analysis: There are rules about how to manage a set of objects. These can relate to the number, the lifespan, handling error conditions, load balancing and more.
P o Indicators in design:...