The Ops Community ⚙️

Nishchya Verma
Nishchya Verma

Posted on

Design Patterns : Introduction

image

What is Design Patterns?

"You know what is a blueprint right?" Its a design plan and Design patterns are the blueprint that you customize as per your own software requirements in order to solve recurring problems in your source code.
Simple? Well let me put it this way, Design patterns give you a way to write your code and structure it in a manner that makes it more effective and at the same time enhance its readability.

Design patterns are not Algorithms!

Often people confuse design patterns with Algorithms. Design patterns are not specific to a problem statement. While algorithms are set of instructions to solve a problem, design patterns are more like how to make the implementation of your algorithm more readable.
In other words, while an algorithm always defines a clear set of instructions that can achieve some goal with, a pattern is a more high-level description of a solution. Its possible that two code follow two different algorithms but implement same Design pattern.

Why do they matter?

The answer to that is simple, every code follow a design pattern, some may be well defined like the ones I'll be sharing about in this Series and others may be just "Poorly designed". Design Patterns are a blueprint of tried and tested solution to common problem in software design.

How Design Pattern are classified?

A pizza if designed round (mostly) and a burger(is also round but not pizza round). You getting me? I guess no, well Design patterns differ in their complexity, level of detail and how are they applicable to the entire system being designed. All patterns can be categorized as below,

  • Creational patterns - How objects should be created. eg. Factory Pattern, Singleton Pattern, etc.
  • Structural patterns - How application classes and objects to be structured. eg. Decorator pattern, Adapter Pattern, etc.
  • Behavioral patterns - How different components of an application should behave. eg. Iterator pattern, Observer pattern, etc.

In next few posts we will be discussing each of the above category and the respective patterns that belong to those categories.
Stay tuned!
image

Top comments (0)