An overview of Software Design Patterns in five minutes

Prateek Nima
3 min readFeb 7, 2023
Photo by Christina @ wocintechchat.com on Unsplash

One of the core components of designing software is building reusable software components. Whenever we start building software the code would be readable and understood across the team but as we start adding new features there is a high chance that the code particulars will become more and more complex adding new hierarchies and will lead to difficulties in knowledge sharing. Additionally, there are frequent changes that come up as we iterate through the processes, and changing a small part of the application should not lead to changes in the entire application.

Software development has been here for ages and programmers have come across many such problems which led to the existence of design patterns. They are templates that can be utilized and customized for software development. Each of the design patterns has its own motivation, structure, and implementation that can be utilized based on the use case you are looking for. This article focuses on giving you an overview and classification of design patterns.

Design Pattern Classification

Design Patterns can be widely categorized into three categories, namely:

Creational Pattern

The Creational Patterns are used to provide a way using we can hide the mechanism of how an object is created. We can provide the client control over the object creation process.

Structural Pattern

The Structural Pattern allows us to design the relationship between and composition between classes/objects. Utilizing this restructuring of a part of code doesn’t lead to the restructuring of the entire project or system.

Behavioral Pattern

The Behavioral Pattern is used to provide a pattern using which we can carry out communication between dissimilar objects.

The following patterns fall under Creational Pattern:-

a. Singleton Pattern

The singleton pattern focuses on creating the object of the class only once. If the client again asks for the object we return the same object instead of returning a new one.

b. Prototype Pattern

The Prototype pattern basically focuses on returning the object by cloning it instead of creating a new object. This reduces the cost of the creation of the object is resource intensive.

The other types of creational patterns are Builder, Factory, and Abstract Factory Patterns.

The following patterns fall under the Structural Patterns:-

a. Adapter Pattern

The Adapter Pattern allows us two different classes or implementations to adapt or be compatible with each other so they can work with each other.

b. Proxy Pattern

The Proxy Pattern represents a structure where an object acts as a proxy in place of the actual object which is responsible for providing the actual function. This pattern thereby enables communication by adding an additional layer between the client and the actual object.

The other types of Structural Patterns are Decorator, Facade, Flyweight, Bridge, and Composite patterns.

The following patterns fall under the Behavioral Patterns:-

a. Observer Pattern

In the observer pattern as the name says, there is an observer while another object subscribes to it and will receive each update from the observer. For e.g. if you follow someone on Instagram you will receive all the updates for that particular account. Here the account you are following is the observer while you are the subscriber.

b. Chaining Pattern

In the chaining pattern, you create a chain of objects. Once a request is received, we iterate through the objects until a relevant object is found that can handle the request.

The other types of behavioral patterns are Visitor, Strategy, Iterator, Interpreter, Commando, Template, Mediator, and Memento design patterns.

Thanks for reading this article so far. I will be writing a few more articles on Design Patterns, focusing on individual patterns. If you liked this article, then please share it with your friends and colleagues. If you have any questions please feel free to shoot them in the comments section below.

--

--