21 February 2006
GoF – Design Patterns
Creational Patterns
What is the pattern?
Problem
Solution
Consequence is very important
Each phase – design, implementation, testing
Think about can create one object?
Create an object a runtime within the class. Controlling mechanism for large number of objects you can create
Program doesn’t need to create.
How to create one object?
5 different recurring problems to create
Creational design patterns abstract the instantiation process
They help make a system independent to how its object are created, composed, and represent.
e.g. Storage – hardware
all the programs in there, but you want to work with computer
real time memory
Hard disk like warehouse.
A class creational pattern uses inheritance to vary the class that’s instantiated, whereas an object creational pattern will delegate instantiation to another object.
Whatever I want, I can open it.
The program doesn’t know what I want.
Two types of objects
This program must be creator
The user is creator object
Student come for enrolment
Abstract factory
Creates an objects of several families of classes.
Example
Abstract mean very common general
Abstract – Human
Subclass - Students
GoF Definition
Provide an interface for creating of related or dependent objects without specifying their concrete classes.
Generalised UML class diagram
References:
http://www.dofactory.com/Patterns/PatternAbstract.aspx
http://www.patterndepot.com/put/8/DesignJava.PDF
The Abstract Factory Method – provides an interface to create and return one of several families of related objects
Control Mechanism and Product is separated.
Case Study: Design Patterns
Tuesday, May 16, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment