---
title: '5 Design Patterns That Are ACTUALLY Used By Developers'
source: 'https://youtube.com/watch?v=YMAwgRwjEOQ'
video_id: 'YMAwgRwjEOQ'
date: 2026-08-02
duration_sec: 567
---

# 5 Design Patterns That Are ACTUALLY Used By Developers

> Source: [5 Design Patterns That Are ACTUALLY Used By Developers](https://youtube.com/watch?v=YMAwgRwjEOQ)

## Summary

This video introduces the concept of design patterns in software engineering, explaining their origin and purpose. It then highlights five design patterns that the presenter finds most useful in practice, providing analogies and code examples for each.

### Key Points

- **Introduction to Design Patterns** [00:01] — Design patterns are typical solutions to common problems in software design, born from recognizing similarities in problems and solutions over time.
- **Analogy: Recipe vs. Birthday Party** [00:44] — An algorithm is like a recipe with step-by-step instructions, while a design pattern is like the concept of a birthday party—a reusable idea that can be adapted to different situations.
- **Gang of Four Book** [02:05] — In 1994, four authors wrote 'Design Patterns: Elements of Reusable Object-Oriented Software', documenting 23 design patterns, commonly known as the Gang of Four book.
- **Three Categories of Design Patterns** [02:42] — The 23 patterns are split into creational (object creation), structural (class composition), and behavioral (communication between objects).
- **Strategy Pattern** [03:24] — The strategy pattern allows you to define a family of algorithms, encapsulate each one, and make them interchangeable. It's useful for avoiding messy if/switch statements, e.g., different cake recipes or navigation modes.
- **Decorator Pattern** [04:35] — The decorator pattern lets you extend an object's behavior without modifying its original implementation, by wrapping it in a decorator class that implements the same interface.
- **Observer Pattern** [05:28] — The observer pattern is used to notify interested parties (subscribers) when something happens (publisher). It involves a publisher with subscribe/unsubscribe/notify methods and subscribers that implement an update method.
- **Singleton Pattern** [06:21] — The singleton pattern ensures a class has only one instance and provides a global point of access. It's useful for resources like database connections, but requires thread-safety measures like locking or using Lazy<T>.
- **Facade Pattern** [07:53] — The facade pattern provides a simplified interface to a complex subsystem, hiding implementation details and making code cleaner. It's useful for poorly designed libraries.
- **Refactoring Guru** [08:59] — The website refactoring.guru covers all 23 design patterns and is a great resource for learning and reference.

### Conclusion

The video emphasizes that while there are 23 design patterns, only a handful are used frequently. Familiarity with all patterns helps in recognizing when to apply them, and resources like refactoring.guru are invaluable.

## Transcript

so in today's video we're going to talk about design patterns now high level programming languages have been around since around the 1950s and since then solve all sorts of different problems over time programmers have realized that
there's often some similarities between the problems and the solutions they're not exactly the same so you can't create a library or use an algorithm to solve it instead they would reuse some of the main ideas of the solution for the
and eventually names were given to these typical Solutions and that is how design patterns were born so what is a design pattern if you're struggling to work out the difference between a design pattern and an algorithm then maybe this analogy
will help so let's say it's my birthday tomorrow and my wife is going to bake me follow a recipe and this is going to give a step-by-step instructions on how to bake that cake the recipe in this case is an algorithm it's giving you
step-by-step instructions on how how to bake a cake you can repeat over and over again to produce the same thing sure you might switch out some of the ingredients to produce different cakes but these are really just different input variables as
it's my hypothetical birthday I also want to have a birthday party now if you head you're probably thinking about balloons and Banners and maybe someone out at least that's what you all think about now but everybody's idea of a
there's no set steps to follow there's no recipe like you have with a cake essentially a birthday party is going to be different for every person like the problems that we face in software engineering but let's imagine that you
you see what everyone else is thinking if everyone's thinking about a birthday party even though they're very different you would still recognize it as a birthday party the birthday party in this case is a design pattern it's the
concept of a birthday party that can be reused even if everything else is slightly different hopefully that analogy makes sense but if it does let's have a look at what the design patterns actually are in 1994 four authors wrote
down 23 design patterns in the book design patterns elements of reusable object-oriented software now obviously that's a bit of a mouthful it's not something you can talk about at a party for example so most people call
it the gang of four book if you've been programming for a little while already some of the design patterns even without realizing it most of them are actually just common sense I know when I first started looking at them I recognized
them immediately for patterns I use in my own code even if I gave them a slightly different name so we have 23 design patterns and these are split into three main groups we have the creational design patterns so these relate to
creating objects in your code we have the structural design pattern so how we especially when they get quite large and finally we have the behavioral design between those objects and their responsibilities now you might be
I'm never going to remember any of those but no one's really expecting you to know all 23 design patterns but it's worth looking through them all and being familiar with them so that when you do have a problem you can think ah that
pattern and then you can go look it up and learn a bit more and see if it applies and the thing is out of all of these different design patterns there's only really five that I find myself using over and over again so let's have
pattern we're going to look at is the strategy pattern now let's go back a bit to that cake baking analogy let's say you love cake so much that you decide to write an application that will give you cake recipes so let's say you start off
with a birthday cake recipe but later you want to add in a red velvet cake and then a carrot cake now you could just do this with if statements and switch statements and add in all the cakes that way but then you want to add in a coffee
cake and a lemon cake and all of these different cakes and eventually your code and it's all going to get really really messy and the thing is the code in your much about which cake you pick this is where the strategy pattern comes in you
own classes and have each of them implement the same methods and then when have to do is run two methods get ingredients and get method and this is of achieving the same thing in your application let's say you've got a Maps
application and you want to provide navigation via walking via car via cycling they're all going to have the same sort of functions but the actual for each of them this is definitely one pattern that's worth having in your
toolbox to help you rightly encode the next pattern that I use the most is The now if you need to extend an object without actually changing the original implementation then The Decorator pattern is one way to do that now I've
in my video about solid as it's one of the ways that you can make your code modification I'll put a link at the end haven't watched it already again this is one of the patterns that I've used
without realizing it before whenever you wrap a class in another class you're effectively using The Decorator pattern the way we normally do this is to have interface as the component you want to extend and then in The Decorator
Constructor we take in that component as an argument you can then implement the original component but now you can add in additional functionality either before or after you make that call number three is the Observer pattern
this pattern is something you're probably very familiar with already even pattern before the Observer pattern is used whenever you want to notify interested parties that something has happened if your subscriber to my
every Sunday you will get an email from me it's not sent to everyone who watches my YouTube videos or reads my blog it's only sent to those select few who have subscribed to my newsletter this is how the Observer pattern works you have a
publisher that implements the Subscribe unsubscribe and notify subscriber methods you then have a subscriber interface that all the subscribers need to implement to let the publisher notify them when a subscriber subscribes to a
publisher they get added to an array and then all the publisher needs to do is to Loop through that array calling the update method on all the subscribers now look at is the Singleton pattern now when we think about Singleton's we think
about creating one thing of course we have things like Global variables that you can specify and be able to access anywhere in your code the problem with and that causes lots of different problems but there are cases where we do
need to have a single object and make sure that we have a single object everywhere such as if you've got a database that you want to access you don't want a different connection to the database for every single time that
to do this is to create a sealed class with a private Constructor having a outside of the class can create a new instance of it so you can't do new whatever you then create a separate method or a property that lets you
create an instance of that class this is then stored in a static variable inside the class the problem with this code is is not thread safe you could have two threads call this code at exactly the same time they both reach that null
check the instance would be null and they'd end up creating two instances of the same object now to get around this we need to have some form of locking mechanism so we need a way to stop the other threads from accessing the code if
to do this we have the same initial null check but then we implement the lock and then we check again to see whether the instance is still null before then two threads from creating separate instances of the object
another way to do this if you're using C sharp.net4 is with the lazy type it's still thread safe but it uses a lot less code the last pattern that we're going to look at is the facade pattern now this is one that's essential to software
the facade pattern is all about Simplicity we're constantly using even though they save us time they can make our code messy and complicated and
more than we actually need them to do let's say you're making use of a fictional logging library that isn't very well designed this Library can send logs to a file it can send it to the console and it can even send you a slack
message the problem is this log Library only has one method called log and you request what type of log message it is as well as how you want to log in rather than clutter up your code with all these implementation details you can create
methods that you can use throughout your code all of this messy code that's caused by this bad library is then just restricted to one class and if you do decide to change out the logging library then you only have one place to change
it and the rest of your code doesn't need to be affected so these are the know a lot of other developers do too but there's another 18 patterns that we having a look at them so you're familiar with them if you have them in the back
least something about them when you come to solve a problem there's a great website called refactoring.guru that covers the 23 design patterns from the use them it's definitely worth bookmarking so you can reference it
later on if you like this video as I mentioned earlier I have a video on thank you for watching and I'll hopefully see you in the next video hopefully see you in the next video foreign
