Visit Map

Saturday, May 19, 2007

Design Pattern -Builder Pattern


The builder Pattren intent is to Seperate the construction of a complex object from its representation so that the same construction process can create different objects.The builder pattren is useful when several kinds of complex objects.The Builder parttern is useful when several kinds of complex objects with similar rules for assembly need to joined at runtime but results in different object types.It achives this seperating the process of building the object from itsellf.t

The builder pattern creates complex objects in multiple steps instead of in single step as in other patterns.

Benefits

It permits you to vary an objects internal's internal representation.

It insolates the code for construction and representation

It provides finer control over the construction process.

GOF Creational pattern - Abstract Factory

More than Factory – allows creation of class families
Go to Sears and order a kitchen make-over. Same order request process can yield very different kitchen drawers, doors and hardware
Provide an interface for creating families of related or dependent objects without specifying their concrete classes

The abstract factory's intent is to provide an interface to use for creating families of related or dependent or dependent objects without actually specifying their concrete classes. For a given set of related abstract classes, this pattern supplies a technique for creating instances of those abstract classes from an equivalent set of concrete subclasses. On some occasions, you may need to create an object without having to know which concrete subclass of object to create.

The abstract factory pattern is also know as Kit.

Benefits

It isolates client from concrete classes.

It eases the exchanging of object families

It promotes consistency among objects

The base GOF patterns are divided into 3 types

Creational

Structural

Behavioral

The Abstract factory pattren come under the creational patterns
J2EE Applicability of Abstract Factory
DAO
Value Object Assembler