Design Patterns  «Prev  Next»

Three Categories of Design Patterns

Three types of design patterns

Behavioral:

Describe interactions between objects. They focus on how objects communicate with each other.
Behavioral object patterns use object composition rather than inheritance. Some describe how a group of peer objects cooperate to perform a task that no single object can carry out by itself. An important issue here is how peer objects know about each other. Peers could maintain explicit references to each other, but that would increase their coupling. In the extreme, every object would know about every other.
The Mediator pattern avoids this by introducing a mediator object between peers. The mediator provides the indirection needed for loose coupling.

Creational:

Make objects of the right class for a problem, generally when instances of several different classes are available.
There are two recurring themes in creational patterns. First, they all encapsulate knowledge about which concrete classes the system uses. Second, they hide how instances of these classes are created and put together.
All the system at large knows about the objects is their interfaces as defined by abstract classes. Consequently, the creational patterns give you a lot of flexibility in what gets created, who creates it, how it gets created, and when. They let you configure a system with "product" objects that vary widely in structure and functionality. Configuration can be static (that is, specified at compile-time) or dynamic (at run-time).
Creational design patterns are those that focus on the instantiation process. These patterns are designed to conceal the creation process from the instances created and encapsulate knowledge used by the objects. The five creational design patterns include:
  1. Abstract Factory
  2. Builder
  3. Factory Method
  4. Prototype
  5. Singleton

Structural:

Form larger structures from individual parts, generally of different classes. Rather than composing interfaces or implementations, structural object patterns describe ways to compose objects to realize new functionality.
The added flexibility of object composition comes from the ability to change the composition at run-time, which is impossible with static class composition.
Structural design patterns examine how objects and classes are composed to form larger structures. In class structural design, new structures are created through multiple inheritance. One class inherits from more than a single parent class to create a new structure. More commonly, object structures combine different objects to form new structures. The following seven patterns have been designated as structural.
  1. Adapter (class and object)
  2. Bridge
  3. Composite
  4. Decorator
  5. Façade
  6. Flyweight
  7. Proxy

Structural patterns focus on creating new structures from existing ones

Design Patterns Explained