Design Patterns

Design Patterns : Composite pattern

Motivation Frequently programmers develop systems in which a component may be an individual object or it may represent a collection of objects. Intent Compose …

Design Patterns : Iterator pattern

What is iteration? In computer science, an iterator is an object which allows a programmer to traverse through all the elements of a collection, regardless of …

Design Patterns : Builder pattern

Motivation To reduce the size of a class that has many methods. Also to allow step-by-step construction of a target object. Intent Separate the construction of …

Design Patterns : Adapter pattern

Motivation Sometime a toolkit class that’s designed for reuse isn’t reusable only because its interface doesn’t match the domain-specific interface an …

Design Patterns : Facade pattern

Motivation Structuring a system in to subsystem helps reduce complexity. A common design goal is to minimize the commutation and dependencies between systems. …

Design Patterns : Flyweight pattern

Motivation There are cases in programming where it seems that you need to generate a very large number of small class instances to represent data. Sometimes …

Design Patterns : Singleton

Motivation It is important for some classes to have exactly one instance. As an example although there can be many printers in a system, there should be only …

Design Patterns : Chain of Responsibility

Motivation Object-oriented developers strive to keep object loosely coupled, keeping the responsibility between objects specific and minimal.. This leads to …

Design Patterns : Observer Pattern

Definition Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. …

Design Patterns : Factory Method

Motivation As a class developer, you will ordinarily provide class constructors to let users of your class instantiate it. However, a client that needs an …