top of page
Writer's pictureSunil Kumar Yadav

Design Pattern: Overview of Reusable Object-Oriented Software

Updated: Sep 24, 2023


In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design.


Before diving into design patterns, it's important to mention GoF. What is a Gang Of Four?

The Gang of Four are the authors of "Design Patterns: Elements of Reusable Object-Oriented Software". The book was released in 1994 and still to this date it resonates with software developers.


It’s an important book describing twenty-three Object-Oriented Design Patterns & various development techniques. The four authors are:

  1. Erich Gamma

  2. Ralph Johnson

  3. John Vlissides

  4. Richard Helm

In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. Design patterns are concepts used to solve recurring software engineering problems.


Why do we need to know Design Patterns?

  • Design patterns can speed up the development process.

  • Design patterns are a toolkit of tried and tested solutions to common problems in software design.

  • Design Patterns provide easy-to-recognize and use OOP solutions to common problems.

  • Design patterns define a common language that you and your teammates can use to communicate more efficiently.

Types of Design Patterns

GoF has classified design patterns into three categories below.

  1. Creational Design Pattern

  2. Structural Design Pattern

  3. Behavioral Design Pattern


Let's try to understand these three design patterns.


Creational Design Pattern

The first design pattern is the creational pattern. These design patterns deal with the creation of an object. It provides ways to instantiate single objects or groups of related objects.


Creational Design Pattern Types
Image: Creational Design Patterns

Structural Design Pattern

The second type of design pattern is the structural pattern. The design patterns in this category deal with the class structure such as Inheritance and Composition. It provides a manner to define relationships between classes or objects.


Types of Structural Design Patterns
Image: Structural Design Patterns


Behavioral Design Pattern

The third type of design pattern is the behavioral pattern. This type of design pattern provides the solution for better interaction between objects, how to provide loose coupling, and flexibility to extend easily in the future.

Types of Structural Design Patterns
Image: Structural Design Patterns

Conclusion

Design patterns are not solutions but rather concepts that can be applied to common software engineering problems. Using a good design pattern in the wrong context can lead to negative consequences and it's referred to as anti-pattern. With the current pace of features in modern languages supporting OOP provides very good abstraction support and developers may not need to write lenghty design patterns to solve many recurring problems.
73 views0 comments

Recent Posts

See All

Comentarii


bottom of page