Fireship · @fireship

10 Design Patterns Explained in 10 Minutes

Uploaded March 14, 2022 · Length 11:04

10 Design Patterns Explained in 10 Minutes

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.

  1. 0:00

    when you first become a junior developer

  2. 0:02

    your code will look like Playdoh snakes

  3. 0:04

    but as you progress to senior developer

  4. 0:05

    and learn about software design patterns

  5. 0:07

    your code will look like the cysteine

  6. 0:09

    chapel but when you then progress to

  7. 0:11

    principal engineer you'll realize that

  8. 0:13

    nobody wants to maintain the cine Chapel

  9. 0:15

    for a silly website and go back to

  10. 0:16

    making Play-Doh snakes in today's video

  11. 0:18

    you'll learn about 10 different software

  12. 0:20

    design patterns along with the pros and

  13. 0:22

    cons of using them which can be very

  14. 0:23

    subjective and controversial one of the

  15. 0:25

    most influential books in the history of

  16. 0:27

    programming is design patterns by four

  17. 0:29

    C++ Engineers called The Gang of four it

  18. 0:31

    breaks down 23 different approaches to

  19. 0:33

    address recurring problems that

  20. 0:35

    programmers face which are categorized

  21. 0:37

    as creational patterns how objects are

  22. 0:39

    created structural patterns how objects

  23. 0:41

    relate to each other and behavioral

  24. 0:42

    patterns how objects communicate with

  25. 0:44

    each other becoming a proficient

  26. 0:46

    software engineer is not about

  27. 0:47

    memorizing the syntax of a programming

  28. 0:49

    language but rather the ability to solve

  29. 0:51

    problems with it by the end of this

  30. 0:53

    video you'll understand a variety of

  31. 0:55

    different patterns for solving problems

  32. 0:57

    as they relate to Modern app developers

  33. 0:59

    before we get started I want to give a

  34. 1:00

    big shout out to refactoring doguru they

  35. 1:02

    gave me permission to use some of their

  36. 1:04

    Graphics that explain design patterns

  37. 1:06

    better than anything else out there

  38. 1:07

    they're based in Ukraine and it's

  39. 1:09

    seriously one of the coolest programming

  40. 1:10

    websites on the internet design patterns

  41. 1:12

    are really interesting because they're

  42. 1:13

    not just like algorithms that you can

  43. 1:15

    copy and paste from stack Overflow you

  44. 1:17

    actually need to use your brain to

  45. 1:18

    implement them it can be tempting to

  46. 1:20

    implement them all over the place but

  47. 1:21

    when used improperly they can add

  48. 1:23

    additional complexity and boilerplate to

  49. 1:25

    a code basee the book is not the Bible

  50. 1:27

    and there are many criticisms of it

  51. 1:28

    regardless knowing how to write

  52. 1:29

    recognized design patterns will help you

  53. 1:31

    level up as a programmer the first

  54. 1:33

    pattern we'll look at is Singleton which

  55. 1:35

    is very easy to understand it's a type

  56. 1:36

    of object that can only be instantiated

  57. 1:39

    once in typescript we might Implement a

  58. 1:41

    Singleton class called settings to

  59. 1:42

    represent the global app settings data

  60. 1:45

    we'll give it a static instance property

  61. 1:47

    and then make its Constructor private so

  62. 1:48

    that it cannot be instantiated with the

  63. 1:50

    new keyword we then create a static get

  64. 1:52

    instance method that will check to see

  65. 1:54

    if the instance has already been created

  66. 1:55

    and if not it will create a new one and

  67. 1:57

    that ensures that only one object can be

  68. 1:59

    created that's great and all but here's