DEV Community

Cover image for Why Design Patterns ?
Abhiram
Abhiram

Posted on

Why Design Patterns ?

As a developer, as we work on enterprise application problems using a programming language. We document the best practices & common recurring problems and proven solutions to those problems.

  • The recurring problems and ready-made solutions which can be applied universally are Design Patterns

Design Patterns

  • Helps to identify recurring problems + Ready-made solution to it.

Example: If you want to create one instance of the class no matter how many times the objects have been created, we can use a design pattern.

  • Idea of design pattern was born in Civil Engineering.
  • Gang of Gour have popularized design patterns through their book.

Why Design Patterns

  1. Reuse of particular situation & solution.
  2. Application Structure will get better.
  3. As it is proved and used universally, any developer can understand the flow of Application easily.
  4. Provides common language across all community.

Types Of Design Patterns

Types of design pattern depends on the problem.

  1. Core pattern catalogue.
  2. Java EE patterns catalogue.

Core pattern catalogue -

  1. Creational Design Pattern (Deals with problem's related to Object creation)
  2. Structural Design Pattern (Deals with problem's related to Relationship between classes)
  3. Behavorial Design Pattern (Deals with problem's related to communication should happen between objects and classes)

Figure depicts Types of Design patterns

How To Study & Use Design Patterns?

After learning the basics of object-oriented programming, one should follow the three-step learning process given below:

Acceptance: First, try to accept the fact that design patterns solve commonly occurring problems in object-oriented software design. Hence, when we are developing any object-oriented software we should not complicate the process by reinventing the wheel.

Recognition: Recognize the importance of following the best practices while developing object-oriented software applications. Read about the problems that are solved using design patterns and identify similar problems in your own development work. In this way, we may find a way to use these design patterns efficiently.

Internalization: Once a suitable design pattern is identified for our software application, we can try to implement it and add it internally to our application in such a way that it provides reusability, manageability, and extensibility.

Top comments (0)