What are Design Patterns?

Inspired by Johnathan Mills Pluralsight course

What are Design Patterns?

Design Patterns are our current best guess for some common problems in software development. An example would be: the pedestrian traffic problem or “how can I manage pedestrian traffic in a city?”, urbanist-architects have a current best guess to solve it — the sidewalk. That’s what we could consider to be a Design Pattern.

What does it take to be a Design Pattern?

  1. Needs to solve a problem
  2. Needs to be a proven solution (It has been used before in many contexts and worked)
  3. Needs to be reusable
  4. It can’t be obvious. For example, assigning a value to a variable to store it can’t be considered a Design Pattern
  5. Needs human intervention to be adapted to a certain context

Why use Design Patterns?

  1. Makes communication between developers easier by creating a common vocabulary
  2. Makes the developing process easier by providing reusable solutions for common problems

What are some Design Patterns’ types?

  1. Creational: solves problems related to creating new instances and objects
  2. Structural: solves problems related to having a relationship with an object — either extends or simplifies an object
  3. Behavioral: solves problems related to cooperation between objects — how they manage responsibilities and communication sticking to good design

What are Creational Patterns examples?

  1. Factory: solves the problem of creating multiple similar objects
  2. Singleton: solves the problem of assuring it will be only one instance of an object
  3. Module: solves the problem of organizing methods. Works like a toolbox — grouping similar methods

What are Structural Patterns examples?

  1. Decorator: solves the problem of extending an object's functionality while protecting current behavior.
  2. Façade: solves the problem of simplifying interaction with an object.
  3. Flyweight: solves the problem of reducing memory footprint on application context through sharing data between similar objects

What are Behavioural Patterns examples?

  1. Observer: solves the problem of notifying multiple objects when an event happens
  2. Mediator: solves the problem of communication between objects while maintaining them decoupled
  3. Command: solves the problem of tracking an object's execution history. Also makes implementation more solid, decoupling it from execution

Conclusion

This article only touches the tip of the iceberg concerning Design Patterns discussions. There is even a totally different type not approach here: Concurrency Patterns. To know more follow the links below or start your own journey 🚀.

Learn more about Design Patterns:

Bruno Dias © March, 2023