1) What is a software design pattern? A design pattern is a solution to a general software problem within a particular context. Context : A recurring set of situations where the pattern applies. Problem : A system of forces (goals and constraints) that occur repeatedly in this context. Solution : A description of communicating objects [...]
Tag Archives: Design Patterns
Decorator Design Pattern
August 7, 2008
Intent of Decorator Design Pattern: Attach additional responsibilities to an object dynamically.Decorators provide a flexible alternative to subclassing for extending functionality.[GoF,p175] Client specified embellishment of a core object by recursively wrapping it. Wrapping a gift,putting it in a box and wrapping the box. Problem:You want to add behavior or state to individual objects at runtime.Inheritance [...]
Abstract Factory Pattern
August 6, 2008
What is Abstract Factory Pattern? Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Wikipedia says: A software design pattern, the Abstract Factory Pattern provides a way to encapsulate a group of individual factories that have a common theme. Intent: Define an interface for creating an object,but let [...]
Template Design Pattern
August 6, 2008
What is Template Design Pattern? An abstract class defines various methods and has one non-overridden method which calls the various methods. Wikipedia Says: A template method defines the program skeleton of an aligorithm.The aligorithm itself is made abstract,and the subclasses override the abstract methods to provide concrete behavior.First a class is created that provides the [...]
Using the Prototype pattern to clone objects
October 9, 2007
Prototype pattern is one of the creational patterns that concentrate on duplicating objects if needed. Assuming that we are in process of creating a template. Most of the times, we copy an existing template, do some changes in it and then will use it. Technically, we make a copy of the source, make some changes [...]
Working with Virtual Proxy Pattern
September 25, 2007
Application is often a collection of components and in most of the situations it may be the case that a component should be loaded until it is first accessed by the Client. Reasons may be that the component in consideration may be using most of the system resources. For example, consider the Microsoft Word Application [...]
Factory pattern – Design Patterns in Java/J2EE
August 27, 2007
Creational pattern deals with the creation of objects and it hides the complex logic involved in the object creation object from the clients. One of the common creational patterns is the Factory pattern and it is used extensively in Applications. Let us understand what factors should be considered in mind while designing a Factory pattern [...]
Singleton Pattern – Design Patterns in Java/J2EE
August 21, 2007
Situations often will demand for the existence of only one object for a particular class in an Application. For example, the existence of only one Database Connection for a particular session, one object referencing the set of Global properties being shared across the various modules, etc. Such classes are candidates to be designated as Singleton [...]
Template method Pattern – Design Patterns in Java/J2EE
August 21, 2007
A Template method pattern provides a skeleton for performing any sort of algorithm or an operation, and it allows the sub-classes to re-define part of the logic. Let us directly get into an example to clarify things in a much better manner. For example, if we wish to write a String Decorator class, which decorates [...]
State Pattern – Design Patterns in Java/J2EE
August 21, 2007
State pattern falls under the category of Behavioural patterns. Assume that we have an object and its behavior is largely dependent on the state of its internal variables. Consider the following example, Person.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 package tips.pattern.state; [...]






February 13, 2009
4 Comments