Classification of design patterns

In the book Design Patterns: Elements of Reusable Object-Oriented Software, the design patterns have been classified into three major categories:

  • Creational patterns: These patterns define how the objects can be created so that your code can be made independent of which objects are present, and hence decouples it from the impact that may happen when new objects are introduced into the code base. This requires the isolation of the object creation logic from the code base. The patterns, such as Singleton and Factory, come under the category of creational patterns.
  • Structural patterns: Unlike creational patterns, which deal with how the objects are created, the structural patterns are often used to describe the composition of how the individual classes and objects will make up a larger structure. The structural patterns, instead of focusing on how to compose an interface or implementation, will rather focus on how to compose objects to realize new functionality. Patterns, such as proxy pattern, come under this category.
  • Behavioral patterns: Behavioral patterns are used to describe the algorithms and the responsibility an object will fulfill. These patterns also define the way the communication happens between the different objects, and shift your focus on how the different objects are interconnected. Chain of Responsibility, Observer, and Visitor patterns are a few examples of the patterns that come under the category of behavioral patterns.

The different patterns do not mark the choice that only a single pattern can be used in the development of the application. Rather there are times when these patterns can be in conjunction with one another, because a particular pattern complements the functionality of another pattern. Which patterns to use will depend completely upon what the application demands. Let's take a look at what may define the choice of a design pattern.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.186.46