Tags » Design Patterns

Singleton Design Pattern

Definition:

Ensures a class only has one instance and provide global point of access to it.

Class Diagram:
Example from Text Book:

The following example taken from “Heads First Design Pattern” book. 405 more words

Design Patterns

Factory Method & Abstract Factory Design Pattern - A Together Look

Often times both of these patterns are confused one for other. Both are creational patterns and both creates object(s).

Factory Method creates an Object and defer instantiation to its subclasses. 178 more words

Design Patterns

Abstract Factory Design Pattern

Definition:

Provide an interface for creating family of related or dependent objects without specifying the concrete classes.

Class Diagram:
Example from Text Book:

The following example taken from “Heads First Design Pattern” book. 10 more words

Design Patterns

Factory Method Design Pattern

Definition:

Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to the subclasses. 25 more words

Design Patterns

Composite design pattern

Composite objects are objects that contain other objects. A drawing may be composed of graphic primitives like circles, squares etc. Now we may want to say resize the circle or the rectangle which we can do individually, or we may want to resize the whole drawing itself. 161 more words

Android

Understanding strategy pattern by designing game of chess

Today we will try to understand Strategy Pattern with the help of an example.
The example we will consider is The Game of Chess. The intention here is to explain strategy pattern and not to build a comprehensive Chess Game solution. 441 more words

Design Patterns