Design Patterns  «Prev 

Behavioral, Creational, Structural Types of Design Patterns

Based on the official Design Pattern Book, "Design Patterns: Elements of Reusable Object-Oriented Software", there are 23 design patterns. These patterns can be grouped into three categories:
  1. Creational,
  2. Structural and
  3. Behavioral patterns.
  4. In addition, we will discuss another category of design patterns: J2EE Design patterns.
  1. Creational Patterns: These design patterns provide ways to create objects while hiding the creation logic, instead of instantiating objects directly using the new operator. This gives the program more flexibility in deciding which objects need to be created for a given use case.
  2. Structural Patterns: These design patterns deal with class and object composition. The concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionality.
  3. Behavioral Patterns: These design patterns are specifically concerned with communication between objects.
  4. J2EE Patterns: These design patterns are specifically concerned with the presentation tier. These patterns were formerly identified by Sun Java now Oracle.

Name of the Pattern

The name of the pattern is a one or two word description that pattern-literate programmers familiar with patterns can use to communicate with each other.
Examples of names include "factory method", "singleton", "mediator", "prototype". The name of the pattern should communicate to the programmer the problem it solves and the solution.

What are the elements of a design pattern?

1) The name of the pattern is one or two word description that pattern-literate programmers familiar with patterns can use to communicate with each other. Examples of names include 1) factory method 2) singleton 3) mediator 4) prototype. The name of the pattern should recall the problem it solves and the solution.

2) The problem the pattern solves includes a general intent and a more specific motivation or two. For instance, the intent of the singleton pattern is to prevent more than one instance of a class from being created. A motivating example might be to not allow more than one object to try to access a system's audio hardware at the same time by only allowing a single audio object.

Gang of Four Patterns
3) The solution to the problem specifies the elements that make up the pattern such as the specific classes, methods, interfaces, data structures and algorithms. The solution, also includes the relationships, responsibilities and collaborators of the different elements. Indeed these inter-relationships and structure are generally more important to the pattern than the individual pieces, which may change without significantly changing the pattern.

Gang of Four Patterns
4) Often more than one pattern can solve a problem. Thus the determining factor is often the consequences of the pattern. Some patterns take up more space and some take up more time. In addition, some patterns are more scalable than others.

Ad Microservices Patterns