Sunday, November 30, 2008

Singleton Pattern

Singleton pattern governs the instantiation process. It is a type of creational pattern. Singleton proposes that at any time there can only be one instance of a singleton (object) . Implementation has two stpes:
Step 1: Provide a default Private constructor
Step 2: Create a Method for getting the reference to the Singleton Object
Singleton Implementation


Sample code that uses singleton object


Labels:

Saturday, November 29, 2008

Design Patterns

Design patterns are commonly defined as time-tested solutions to recurring design problems. 

Initially Software  Design Patterns were published by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides in 1995.In their book(Design Patterns: Elements of Reusable Object-Oriented Software), they present 23 design patterns organized into three categories:

·        Creational

·        Structural

·        Behavioral design patterns

 Now the design pattern community has grown in size and hence lots of patterns are available

To conclude Design patterns have two major benefits.

1.      They provide the way to solve issues related to software development using a proven solution. The solution facilitates the development of highly cohesive modules with minimal coupling.

2.      Design patterns make communication between designers more efficient.