Master java skills

Design Patterns – Introduction

There are some scenarios which occur more frequently than others in designing java programs. The solutions of such problems can be done in several ways. But one of those solutions will be certainly best. Those best solutions have been figured out and termed as design patterns in java.

Whenever, a prgrammer encouters such a scenario or problem, he or she must apply appropriate design pattern to it. But before that, he or she should be able to understand which design pattern matches his/her problem. Let’s talk about these design patterns in detail.

Advantages of design patterns

  1. Design patterns are reusable programming solutions to specific kinds of problems
  2. Design patterns provide more clarity to applications designs
  3. They are proven solutions of certain problems, and thus there are very less chances of failures of them
  4. Design patterns make use of best programming practices.
  5. Use of design patterns make developers more solid understanding of an application

Types of design patterns

Primarily, design patterns have been categorized in following categories:

  1. Creational Design Pattern
  2. Structural Design Pattern
  3. Behavioral Design Pattern

1. Creational Design Pattern

Creational patterns talks about how objects should be created. In different use cases, we want objects to be created in different ways. This is where Creational Design Patterns come into picture.

Types of Creational Design Patterns

  1. Singleton Pattern
  2. Abstract Factory Pattern
  3. Factory Pattern
  4. Prototype Pattern
  5. Builder Pattern
  6. Object Pool Pattern

2. Structural Design Pattern

Structural patterns talks about how objects should be created to form a structure of objects using the concept of inheritance. These structures may enhance the functionalities of individual objects. In certain situations, such structures are formed to obtain some specific functionalities. Below are the types of structural design patterns

  1. Adapter Pattern
  2. Bridge Pattern
  3. Composite Pattern
  4. Decorator Pattern
  5. Facade Pattern
  6. Flyweight Pattern
  7. Proxy Pattern

3. Behavioral Design Pattern

Behavioral patterns talks about, as it name suggests, the behaviour and responsibilities of objects. It is concerned with the communication between objects.

  1. Command Pattern
  2. Chain of Responsibility Pattern
  3. Interpretar Pattern
  4. Iterator Pattern
  5. Memento Pattern
  6. Mediator Pattern
  7. Observer Pattern
  8. State Pattern
  9. Strategy Pattern
  10. Template Pattern
  11. Visitor Pattern
  12. Null Object Pattern