Tuesday, May 16, 2006

7 March 2006

Factory Method

Creates an instance of several derived classes.

GoF Definition - Define and interface for creating an object, but let subclasses decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.

Explanation

You can choose which object you can create
Create family of product.
To make a choice until customer come and ask.
Control Mechanism

Generalised UML Class Diagram


How behavior themselves – that’s sequence diagram. One object can

Suitable Human Diagram
Runtime – create on the situation
Otherhand. E.g. already created.
Object – real time, already created, programmer doesn’t know

Make an order them they will create it for you. That means runtime.

Example in software.
Maintainence.

Go to buy tickets
They have tickets already created.

Read Your Case Study

Create Real time object
Which creational patterns
Family of classes
Family of object/ product are created by system.
Allow the customer to choose – Factory Method.

Builder

Separate object construction from its representation.

GoF Definition – Separate the construction of a complex or more than two object from its representation so that the same construction process can create different representations.

Explanation: e.g. Burger King, Mcdonald, KFC

Kid Meal (object)
Various variability (collection of different objects)
UML class diagram


Shop
Kid meal – paying for one product – burger, fries and drink.

Partitioning Patterns – Composite
Generalisation – Abstract
Build – builder

The structure how you do you do your chair.

Prototype

Factory Method

A fully initialized instance to be copied or cloned.

GoF Definition – specify the king of objects to create using a prototypical instance, and create new objects by copying this prototype.

e.g. enrolment certificate – already there
change it according to the users.

Name
Courses
Payment

Copy that change it for necessary.

UML class diagram

Singleton

A class of which only a single instance can exist

GoF Definition – ensure a class has only one instance and provide a global point of access to it.

Explanation

Several of people can use several times as soon as you creates object.
e.g. same software can use from different companies.
UML class diagram

References:
http://www.agilemodeling.com/style/classDiagram.htm

http://www.smartdraw.com/tutorials/software-uml/uml2.htm

http://www.agilemodeling.com/artifacts/classDiagram.htm

http://www.objectmentor.com/resources/articles/umlClassDiagrams.pdf

http://pigseye.kennesaw.edu/~dbraun/csis4650/A&D/UML_tutorial/class.htm

http://www.developer.com/design/article.php/2206791

http://www.128.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/

http://www.builderau.com.au/program/0,39024614,39170202,00.htm

+ public
- private
# protected

These 5 symbols are important in UML Diagram.
Association
Multiplicity (Cardinality)
Composition and Aggregation
Inheritance
Interface

Why we use the Creational Patterns?
Object create on runtime.

Structural Patterns
Relating two class
Both class use different language
Translate
More than two classes how you can structure relate each other?

Bridge – two classes relate each other.

Adapter – different languages

Composite – a lots of classes and objects relate each other.

Decorator – calling the same class, use several times, decorate in one class, using that decorate the room

Façade – interface, one college have many departments, reception is interface for the college.

Flyweight – similar to Façade, so many system out there. Sharing support large number of, a lots of objects existing

Proxy – e.g. filter, firewall unnecessary info. Block, necessary info. Pass through.
One system – proxy behaviour of filter – another system

No comments: