DEV Community

Sonali Gupta
Sonali Gupta

Posted on

What are Design Patterns ?

We see the Wikipedia definition for Design pattern, it says :

"In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations."

Design Pattern can be applied to multiple different context. In can be applied to the game, web application or a mobile application etc. It really doesn't matter what you are designing. They are reusable as well.

Problem -

Create a class with a single instance & that instance will be accessed by all other classes as well.

Solution -

Singleton Design Pattern is the best solution for the above use case.

So every design pattern has a set of rules or specifications for solving the problem. Based on the use case we have to apply the design pattern strategies to our problem while designing the solution which can be flexible, reusable & maintainable.

There are 3 different types of Design Pattern -

  1. Creational
  2. Behavioral
  3. Structural

When should we use the design patterns?
We must use the design patterns during the analysis and requirement phase of SDLC(Software Development Life Cycle).

Design patterns ease the analysis and requirement phase of SDLC by providing information based on prior hands-on experiences.

Thanks !!

Keep Learning :)

Top comments (0)