Hey, Folks! This article might be useful for future software engineers. We will talk about patterns and explain why they are used. If you don’t know about patterns, don’t worry. Without further ado…

Image for post
Image for post

In software engineering, a design pattern is a repeatable solution to the frequently happening issues in software design. A design pattern is not a complete pattern; it cannot be transformed into code directly. A pattern is a template that can be used to solve a problem in different situations. We have different patterns for implementing the undo feature, and one of them is the Memento pattern. Therefore, a design pattern shows you how a user should structure the classes and how the class should communicate with each other. Historically speaking, software engineers ignored to used existing patterns, but rather design their own solutions to problems. One of the reasons for this state of affairs used to be the lack of easily accessible, standard solutions for common software architecture and design problems. There are many different types of patterns available today.

There exist 23 design patterns that were originally documented in the 90s in the book called Design Patterns, Elements of Reusable Object-Oriented Software. The book was written by four authors, often referred to as Gang of Four. Therefore, those 23 design patterns are often referred to as the Gang of Four patterns. I personally recommend you to read the book.

Image for post
Image for post

There are 3 design pattern types, creational, structural, and behavioral. Creational patterns are all about different ways to create objects. Structural patterns are about the relationships between these objects. Behavioral patterns about negotiation and communication between these objects. Don’t forget that these design patterns do not represent all patterns and their work, there are unofficial and undocumented ones, but these are classic ones that every software engineer must understand.

Image for post
Image for post

Before introducing some of the patterns, let’s see why software engineers should study this topic. First, it helps to communicate with other developers at an abstract level, for example, telling your colleague that we need the command pattern to improve this code simply by mentioning its name. Second, it makes you a better designer, you learn how to build reusable extensible, and maintainable software. Last but not least, they help you learn and use new frameworks faster.

Before starting to learn the patterns, I kindly ask you to learn and revise your knowledge about OOP; classes, interfaces, encapsulation, abstraction, inheritance, polymorphism, UML.

Creational Design Patterns are all about class instantiations.

  • Abstract Factory
    Creates an instance of several families of classes

Structural Design Patterns about how classes and objects can be composed, to form larger structures. The structural design patterns simplify the structure by identifying relationships.

  • Adapter
    Match interfaces of different classes

Behavioral Design Patterns are concerned with algorithms and the assignment of responsibilities between objects.

  • Chain of responsibility
    A way of passing a request between a chain of objects

Thank you very much, stay tuned for new articles. Peace✌🏼

Master of Computer Science and Data Analytics at ADA/GW Universities, Researcher, Psychology-lover, Meme-maker, Musician, Writer, AI & Sarcasms!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store