backgroundLayer 1Navigate back to the homepage

What are design patterns?

Patryk Jeziorowski
December 21st, 2019 · 1 min read

High-level overview

OOP (object-oriented programming) gurus once concluded that it’s pointless to reinvent the wheel every time you encounter a problem in application design. They knew they should not always tackle problems from the ground up. Instead, they gathered and categorized battle-tested approaches in structuring code that were reoccurring in many projects. This is why in many systems, applications and frameworks we see repetitive patterns and class diagrams.

Reusing known patterns is not specific to software development. Take a look around you. In literature, themes, motifs and symbols from the bible or other ancient sources are still present in modern writings. This applies also to other aspects of life.

Patterns that worked before are likely to work now. This, in theory, is a promise that design patterns give us.

Before we introduce any specific design pattern, let’s first discuss what are they made of and how they are categorized.

Design Pattern structure

According to GOF, a design pattern is made of four elements:

  1. Name - one or two words that describe the pattern
  2. Problem description - describes when to use the given pattern
  3. Solution - abstract description of classes, objects and their relations in the pattern
  4. Consequences - pros and cons of using the pattern

Each pattern belongs to one of three categories:

  • Creational - patterns responsible for object creation.

  • Structural - patterns involved in the way of composing classes and objects.

  • Behavioural - patterns that describe the way objects and classes work, share tasks and cooperate.

Besides this, there is one more important thing that separates design patterns:

The Scope

Class-scope - when pattern is categorized as class-scope, it means that its goals are achieved at the compile time using inheritance

Object-scope - when pattern is categorized as object-scope its goals are achieved through composition during the runtime


A design pattern is a battle-tested, proven and general solution to a commonly occurring problem. It describes how to solve the given problem and can be used in many different situations.

That’s all you need to know about the basics of design patterns. In the following posts of this series, we’ll introduce the most popular design patterns that you are likely to see and use in your code.

Join our email list and get notified about new content

Be the first to receive our latest content with the ability to opt-out at anytime. We promise to not spam your inbox or share your email with any third parties.

More articles from talkoverflow

Static Factory Methods

Introduction The topic of this short article is pretty simple - creating objects. The most popular basic ways of creating objects in Java…

December 17th, 2019 · 3 min read

React, GraphQL, gRPC and Reactive Microservices - the dataflow in Appwish platform explained

Hello everyone! In this post, I'll explain how Vert.x, gRPC and GraphQL is used in Appwish project to provide APIs for UI applications. We…

January 20th, 2020 · 6 min read
© 2019–2020 talkoverflow
Link to $ to $ to $ to $