Skip to content

Introduction

When designing, implementing, or extending certain functionality in an application, we must * always * think about how to structure our code. Instead of inventing new solutions, it is worth considering whether someone has already solved a similar problem that we are currently considering.

Design patterns are a set of ready-made frameworks of solutions that we should use in our applications. This section is based on the patterns described in the book "Design Patterns: Elements of Reusable Object Oriented Software". This work was written by four authors: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides - they are commonly referred to as Gang of Four. Although more than 25 years have passed since its release, the described problems and their solutions still remain valid.

All design patterns have been divided into three main groups:

  • creational which describe how to create objects
  • structural which show you how to tie objects together
  • behavioral which describe how related objects communicate with each other and what their behavior is towards others.

Design patterns can also be divided according to the scope of application into:

  • class
    • describe the relationship between classes and their subclasses
    • are established by inheritance
    • are static
  • object
    • describe the relationships between objects
    • are static - runtime

Additional sources of knowledge: