What is a Design Pattern?

What is a Design Pattern?

A design pattern is a reusable solution that can be applied to commonly occurring problems in software development, think of them as templates for solving problems.

They're proven solutions that can be easily reused and provide solid approaches to solve issues in software development, they usually are an out-of-the-box solution that can be adapted to suit our own needs.

It's important to remember that they're not an exact solution, their function is to provide us with a solution scheme.

Design Patterns can be divided into several categories, we're going to dig into some of them and look at the most commonly used ones. For the examples, I'm going to use PHP, but the logic can be applied to any existing OOP language.

  • Creational Design Patterns

    • Constructor

    • Factory

    • Abstract

    • Prototype

    • Singleton

    • Builder

  • Structural Design Patterns

    • Decorator

    • Facade

    • Flyweight

    • Adapter

    • Proxy

  • Behavioral Design Patterns

    • Iterator

    • Mediator

    • Observer

    • Visitor