Design Patterns and it’s Types

Sravya Kanagarla
2 min readJul 12, 2019

--

Generally, we will see problems in numerous projects but in different circumstances. On a high level view, problem is same and fix is also the same but circumstances are different. That is where standard solutions(patterns) came into existence to fix those design problems. Design Patterns are nothing but the solutions for common problems.

A design pattern is not a code or an algorithm. It is just a template or a process in which one can design a solution to avoid common problems.

That doesn’t mean to avoid those problems we should strictly follow design patterns. We can follow existing design pattern or we can use it by modifying it according to our business rule or we can design our own design pattern. The only thing is we should able to identify which design pattern is applicable for the problem we are facing.

Types of design patterns:

Design patterns are classified based on their intent. Majorly there are three types of design patterns.

Creational Patterns:

Creational Patterns are all about creation of classes and objects. This will increase flexibility and reuse of the existing code. It can be further divided into class-creation and object-creation.

  • Class-creation will effectively use Inheritance while instantiation
  • Object-creation will effectively use Delegation to do the job

Below are the patterns which fall under creational patterns

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

Structural Patterns:

Structural Patterns are all about composition of classes and objects to make larger structures to provide a new functionality. These structures are flexible and efficient.

  • Structural class-creation patterns use inheritance to compose interfaces
  • Structural object-creation patterns define ways to compose objects to obtain new functionality

Below are the patterns which fall under structural patterns

  1. Adapter
  2. Bridge
  3. Composite
  4. Decorator
  5. Facade
  6. Flyweight
  7. Private Class Data
  8. Proxy

Behavioural Patterns:

Behavioural Patterns are all about communication between the objects of different classes. It’s main concern is communication and assignment of responsibilities between objects.

Below are the patterns which fall under behavioural patterns

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

--

--