Fireship · @fireship
10 Design Patterns Explained in 10 Minutes
Uploaded March 14, 2022 · Length 11:04
Summary
This video explains 10 software design patterns, including Singleton, Prototype, Builder, Factory, and Proxy, and their applications in programming.
- software design patterns
- programming
- singleton pattern
- prototype pattern
- builder pattern
- factory pattern
- proxy pattern
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
when you first become a junior developer
- 0:02
your code will look like Playdoh snakes
- 0:04
but as you progress to senior developer
- 0:05
and learn about software design patterns
- 0:07
your code will look like the cysteine
- 0:09
chapel but when you then progress to
- 0:11
principal engineer you'll realize that
- 0:13
nobody wants to maintain the cine Chapel
- 0:15
for a silly website and go back to
- 0:16
making Play-Doh snakes in today's video
- 0:18
you'll learn about 10 different software
- 0:20
design patterns along with the pros and
- 0:22
cons of using them which can be very
- 0:23
subjective and controversial one of the
- 0:25
most influential books in the history of
- 0:27
programming is design patterns by four
- 0:29
C++ Engineers called The Gang of four it
- 0:31
breaks down 23 different approaches to
- 0:33
address recurring problems that
- 0:35
programmers face which are categorized
- 0:37
as creational patterns how objects are
- 0:39
created structural patterns how objects
- 0:41
relate to each other and behavioral
- 0:42
patterns how objects communicate with
- 0:44
each other becoming a proficient
- 0:46
software engineer is not about
- 0:47
memorizing the syntax of a programming
- 0:49
language but rather the ability to solve
- 0:51
problems with it by the end of this
- 0:53
video you'll understand a variety of
- 0:55
different patterns for solving problems
- 0:57
as they relate to Modern app developers
- 0:59
before we get started I want to give a
- 1:00
big shout out to refactoring doguru they
- 1:02
gave me permission to use some of their
- 1:04
Graphics that explain design patterns
- 1:06
better than anything else out there
- 1:07
they're based in Ukraine and it's
- 1:09
seriously one of the coolest programming
- 1:10
websites on the internet design patterns
- 1:12
are really interesting because they're
- 1:13
not just like algorithms that you can
- 1:15
copy and paste from stack Overflow you
- 1:17
actually need to use your brain to
- 1:18
implement them it can be tempting to
- 1:20
implement them all over the place but
- 1:21
when used improperly they can add
- 1:23
additional complexity and boilerplate to
- 1:25
a code basee the book is not the Bible
- 1:27
and there are many criticisms of it
- 1:28
regardless knowing how to write
- 1:29
recognized design patterns will help you
- 1:31
level up as a programmer the first
- 1:33
pattern we'll look at is Singleton which
- 1:35
is very easy to understand it's a type
- 1:36
of object that can only be instantiated
- 1:39
once in typescript we might Implement a
- 1:41
Singleton class called settings to
- 1:42
represent the global app settings data
- 1:45
we'll give it a static instance property
- 1:47
and then make its Constructor private so
- 1:48
that it cannot be instantiated with the
- 1:50
new keyword we then create a static get
- 1:52
instance method that will check to see
- 1:54
if the instance has already been created
- 1:55
and if not it will create a new one and
- 1:57
that ensures that only one object can be
- 1:59
created that's great and all but here's


