7 Design Patterns EVERY Developer Should Know

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025

Комментарии • 301

  • @RafaeldaSilvaPeres
    @RafaeldaSilvaPeres 2 месяца назад +56

    Yes YES WE LOVE ANALOGIES! Please! Best way of teaching and learning! Starting from the big picture, analogies and then down to the specifics! People seems to want to glorify knowledge sometimes by hitting with the specifics right on their face making them watch and rewatch or just give up on it, but this way u go helps alot!

    • @alizihr6321
      @alizihr6321 3 дня назад

      analogy, glory, big, face, OK! is it me with my brained damaged by *orn?

  • @kopilkaiser8991
    @kopilkaiser8991 Месяц назад +25

    Learning from you is a fun and engaging activity. This is how teaching should be delivered. Structured, concise, and informative 😊

  • @itspoppadom7181
    @itspoppadom7181 4 часа назад

    You've got a follow from me, as you started to explain singleton. I began to see its relation with a global variable just before you confirmed my hunches. Great teaching!

  • @ivanlawrence2
    @ivanlawrence2 2 месяца назад +15

    I love the format of your videos... I also love that in your examples of each pattern you are also reducing the nesting and using early exiting which is the opposite of what the people in the repo I'm currently in have done. My first pass for just about and change is 1st to reduce nesting, 2nd try and apply the appropriate pattern (like taking a constructor with 30 params and converting to a builder pattern, or passing in an object which implements the builder pattern, which means now I'm the lucky SoB who gets to go "fix" all the other code), 3rd weep and commit

    • @ivanlawrence2
      @ivanlawrence2 2 месяца назад +1

      Oh, and "bless your heart" hit me right in the feels... and pronouncing facade the way JFK might have done it (fah-Kay-d) is how I like to explain it ;)

    • @zayne-sarutobi
      @zayne-sarutobi 28 дней назад

      Nesting is really a bane of my coding existence 😭

  • @noodlespwn42
    @noodlespwn42 2 месяца назад +21

    most of these are intuitive. it's great to formalize these concepts and this video does a great job at providing a high level overview of them. thank you

    • @jadedplover1851
      @jadedplover1851 26 дней назад

      except singletons, singletons feel like an artifact of enforced oop where oop is enforced by standards or required by the language, they are essentially a way of taking the oop out of oop, a better solution would just be to use procedural code, there is not really a benefit to utilizing oop features like classes and instances if you are just going to put in extra effort to make sure they can only be used just like procedural code

  • @KineticCode
    @KineticCode 2 месяца назад +368

    To newer developers - when you learn design patterns you generally think "oh i can use this here!" in every scenario, making design patterns your hammer and every code problem a nail. In my experience as a professional developer I have never - not once - deferred to the Design Patterns book to solve a problem. Everytime I had used one in my personal projects however - it was always an imperfect fit to a similar problem. You could say "skill issue" but I'm just pointing out that you should not worry about these things before you're employed. Just make things!

    • @mattwayne9128
      @mattwayne9128 2 месяца назад +109

      Newer developers, you shouldn't be making the decision to not study software engineering concepts based off the anecdotes of anonymous RUclips commenters.
      You will write bad code as you start off. It's inevitable. That's why you practice. Not learning this because of the nebulous idea that you might use it where it "shouldn't be used" is ridiculous.

    • @itztlacoliuhqui
      @itztlacoliuhqui 2 месяца назад +25

      Yeah its not a hammer. Its like 23 different tools actually. Hammer included

    • @KineticCode
      @KineticCode 2 месяца назад +10

      ​@@mattwayne9128 There's a lot of things to learn when starting. There's alot of concepts with varying usefulness with building software. The real question is what information is most applicable to getting yourself into a position where you can have good mentorship and stability in learning(employed). If you learn software dev because you're passionate about it - my comment shouldn't dissuade a single person because they'll learn these things from genuine interest (as I did!). I'm advocating for learning relevant skills rather than all skills, which in my, yes, anecdotal experience, would exclude Design Patterns. Otherwise it's easy to fall into a sea of theoretical knowledge with no idea of how to apply it practically! I appreciate your perspective btw

    • @w花b
      @w花b 2 месяца назад +11

      You're not 100% wrong but I made vidéos games and at the end, I was always regretting not making the code more modular for example. It's basically spaghetti code. Design patterns won't make regrets go away but they definitely will make your life easier in the long run for projects you're supposed to build on top of or modify (anything with a long life span)

    • @barbara_993
      @barbara_993 2 месяца назад +1

      I would agree if we [in my company] we don't require knowledge about design pattern and usage before employment. I doubt that I will let someone further if they do not know what at least singleton is and how to use it.

  • @WestonJP88
    @WestonJP88 Месяц назад +44

    I REALLY like the analogies. That's the best way for me to grasp the actual concept. Just found you on RUclips, and I already like the content.

  • @vincentmontano4518
    @vincentmontano4518 Месяц назад +1

    The analogies are spot on! I learned more from this video than the entire book and online tutorials combined about design pattern.

  • @baej-ultra
    @baej-ultra 10 дней назад

    As someone who’s just getting into Java I really enjoy your videos

  • @MrDoker06
    @MrDoker06 8 дней назад

    This is the best class I have ever had about Design Patterns! It is very clear!

  • @krs-tube
    @krs-tube 2 дня назад

    that was the smoothest transition to an ad I've ever seen :D :D :D ovations

  • @derivadadekonoha
    @derivadadekonoha Месяц назад

    This is the most easiest way knowing to concepts of the design patterns I've ever found. Your clean and structured way of teach gives us the only task of learn, as easy as possible. Thanks for this amazing content....

  • @Simurgh1000
    @Simurgh1000 5 дней назад

    This was a really great way to explain it and I understand the patterns a lot better now. Thank you for the video.

  • @adria3439
    @adria3439 Месяц назад +2

    Nice explanation, you have a great body language and it helps the viewer to keep watching the video

  • @BorisBarroso
    @BorisBarroso 24 дня назад

    I would love to see the equivalent of many of these patterns for functional programming. Excellent explanation I did not remember the name of some of them but used all of them. 👍

  • @wiilamaral
    @wiilamaral Месяц назад

    I recently found your channel, and it’s impressive the way you explain things and make fun at the same time. This makes the learning process much better. Thank you! Subscribed 😉🧑🏽‍💻

  • @hisoka500
    @hisoka500 Месяц назад +1

    Bro, this is the best thing I've seen in a long time! Keep sharing content like this! 👌

  • @alliso1240
    @alliso1240 25 дней назад

    Damn that ad transition was so clean. Got me for a while.

  • @theteacher3163
    @theteacher3163 Месяц назад +1

    loved the video! the way you describe the patterns is amazing. I'm sending this video to every coder I know. Subscribed!

  • @CokYogaIXGXXVII
    @CokYogaIXGXXVII Месяц назад

    The only time I paused was when I liked and subscribed you, amazing video man!

  • @alanabdo5371
    @alanabdo5371 13 часов назад

    I Hope this Video helps me getting some extra points on my Software Engineering exam

  • @ianramirez1577
    @ianramirez1577 2 месяца назад +1

    I learned more from your video than in the university. Thank you and regards from México

  • @PlaymeoffSia
    @PlaymeoffSia 13 дней назад

    that ad transition was smooth, great informative video!

  • @pouyababaie2159
    @pouyababaie2159 2 месяца назад +3

    This was the most easy way to understand all of these standarts. Thanks ;)

  • @HP_Tubcraft
    @HP_Tubcraft 2 месяца назад

    this is a great video! fellow java dev here. i'd love to see more java / spring boot stuff! not enough good java / spring boot influencers on YT imo

  • @abymathew575
    @abymathew575 Месяц назад

    Really nice video. First you explained the concept very well, then you showed the practical implementation in codes with real scenarios. This way of video presentations are really helpful to understand the concept. Thanks for your effort and expecting more from you

  • @miguelmarin1395
    @miguelmarin1395 20 дней назад

    B Rabbit is in the house! I love your videos. You're awesome.

  • @srhatfield
    @srhatfield 26 дней назад +3

    19:35 There is no downside to using the Strategy pattern. Only upsides! One common practice is that you shouldn't change a tested class. If you have to add if/else everywhere, you will be modifying tested classes. Another common practice is to keep each class small and focused on one thing. Using the Strategy pattern helps accomplish that goal.

  • @thomkb
    @thomkb 27 дней назад

    Great video...puts into words what we already "intuited" but now we "know" the why to these patterns. But "freedom units"?

  • @bilL_at4k
    @bilL_at4k 11 дней назад

    Huge respect! Great video! You described all of them really well! My love to all developers struggling with customers! Peace!

  • @yashh7449
    @yashh7449 Месяц назад

    I loved your analogies, you made it so much easier to understand these concepts! Thank you so much ❤

  • @totollygeek
    @totollygeek Месяц назад

    Really cool video, kudos.
    I giggled when you called them “freedom units” 😂

  • @gavinwilliams4330
    @gavinwilliams4330 2 месяца назад +2

    Great video! I love the way you explained things and the way you demonstrated the benefits of each pattern in code.

  • @another_arthur7
    @another_arthur7 Месяц назад

    I like the way you explain how we can actually implement what you tell about, got a new sub

  • @Zeraltz
    @Zeraltz Месяц назад

    Finally I understood these design patterns, you know how to explain things! subscribed

  • @mohamedraslan3504
    @mohamedraslan3504 Месяц назад

    Excellent explanation, loved it a lot, your way of explaining stuff with simple words and analogies is perfect, Thanks

  • @diegovillafane6313
    @diegovillafane6313 9 дней назад +1

    Great video dude, I always come back to it

  • @saqibshafin
    @saqibshafin 11 дней назад

    Thank you so much for this Video!
    And I loved your StrategyPattern explanation. Good Work!
    Thank you again.

  • @acrosstheocean25
    @acrosstheocean25 Месяц назад +16

    A little confused on the example for the observer pattern you gave here regarding performance. You would still have to loop over however many subscribers there are in order for them to get the notification, and assuming that they are all on the same machine, the work will still be done at the same place. So I don't quite understand how there is a performance gain in this specific scenario, unless that was just an analogy for a distributed system?

    • @Howard-v3g
      @Howard-v3g 13 дней назад +1

      The main take away is the first example is a PUSH/Notify (e.g. email list, API calls, etc.) and the second example should have been a PULL/Observe (e.g. RSS feed, checking for updates, etc.)

    • @daydreamical
      @daydreamical 7 дней назад

      I was initially confused like you for the same reason but after listening closely to what he says in the end after showing the code, my interpretation is that the point he's making is that in example 1 you're looping through subscribers of ALL video channels looking for those that subscribe to your channel in order to notify them, while in example 2 you only loop through the subscribers to your channel, since those are readily available in this case (they were the ones that called the "subscribe" method). But, of course, I might be totally wrong here xD

    • @kadin.h
      @kadin.h 5 дней назад +1

      ​@@daydreamical Not quite. I don't think the example was the best, but I can see why he used it. Using the Subscriber interface allows you to have many different types of objects subscribe to something happening. Then those objects can control what happens on the notification - because the VideoChannel knows there's an "update()" method.
      The first approach only allowed a single type of object.
      You very much still have to loop through each item in the array and call "update()" but how the update happens or what it does is controlled by the subscriber and how it implemented the interface.

    • @daydreamical
      @daydreamical 5 дней назад

      @@kadin.h I think I see what you mean but, in my opinion, if that was the point, then it'd be just another example of the "strategy" pattern, not an example of the "observer" pattern. Anyways, probably a better example would be showing that, without the observer pattern, your user objects would be periodically polling the video channel object, trying to find out if there are new uploaded videos (and how that would lead to a lot of wasted processing).

    • @TyRadman
      @TyRadman 4 часа назад

      He should've used an event instead and it would've communicated the pattern better

  • @shahabjami3161
    @shahabjami3161 2 месяца назад +9

    Great refresher! Love these type of vids

  • @abzrg
    @abzrg Месяц назад

    09:03 schtruschural pattern
    Simple and concise explanation. Thanks!

  • @drushkyy2017
    @drushkyy2017 2 месяца назад

    hey my friend, please do more videos where you just show us the code and teach it as you go. you do a great job of explaining simply!!!! thanks

  • @dariusdbbowser6329
    @dariusdbbowser6329 6 дней назад

    I'm a big fan of the Builder pattern, I've used it in several codebases.

  • @WiktorWandachowicz
    @WiktorWandachowicz Месяц назад +2

    19:54
    "And I know this is gonna hurt some feelings.
    A lot of y'all are just 'IF ELSE-ing, IF ELSE-ing' everything. You know WHO YOU ARE!"
    Pure gold 😁🤣😂

  • @Ni7ram
    @Ni7ram 2 месяца назад +7

    about subscriber pattern.. i know its useful, and the core of reactive prograaming, but I dont see the advantage in this example. i mean you say loop through users is not performant, but it ends up using a foreach, that is essentially the same.
    the thing is, i dont think it can be done without looping the array somehow
    great video as always man

    • @TVDaJa
      @TVDaJa 2 месяца назад +4

      Yeah I was thinking the same thing. I always thought the big improvement it provides is de-coupling things that need to SOMETIMES exchange some data/signals

    • @kingcrashplays
      @kingcrashplays Месяц назад +1

      I believe it would be more useful when let’s say a subscriber only wants to be notified for specific events, not all events. Perhaps a user subscribed to a channel doesn’t want to be notified a new video is released but is still a follower of the channel.

  • @ap_gettingthere
    @ap_gettingthere День назад

    I like how you explain things. Thank you for that! Been subscribed for some time. :) But honestly, freedom units? 😂 Imperial doesn't sound good, anymore? 😅 Keep it up Forest! I like your content, whatever units you like to use. ❤

  • @BogdanNedelcu-b3n
    @BogdanNedelcu-b3n Месяц назад

    Great video, didn't know I was using so many patterns.

  • @jamiecodes96
    @jamiecodes96 2 месяца назад

    This was so good. I’m sharing it with my dev team! Thank you

  • @karthikgaddam831
    @karthikgaddam831 3 дня назад

    Good for brush up and revision .
    Thanks

  • @Jarrod0067
    @Jarrod0067 6 дней назад

    Take it to the next level by decoupling the factory from explicit class declarations in the base application by using a registry (hashmap) and a module loader, allowing seemingly infinite number of user types which don't rely on a switch

  • @ahmadiyad2860
    @ahmadiyad2860 Месяц назад

    your voice like graves from call of duty thank you man for all these videos you make

  • @bradchellingworth5973
    @bradchellingworth5973 Месяц назад +1

    first time viewer here, listening to this in the background and keep thinking im getting a lesson from Matthew McConaughey

  • @tanellomondacasilva2056
    @tanellomondacasilva2056 19 дней назад

    The commercial was introduced so smoothly that I watched it whole and with pleasure
    great video!!

  • @ClaraWilson-s3o
    @ClaraWilson-s3o 19 дней назад +32

    >>I had problem comprehending trading in general. I tried watching other RUclips trading channels, but they made the concepts more complicated. I was almost giving up until when i discovered content and explain everything in detail. The videos are easy to follow

    • @YppMike
      @YppMike 19 дней назад

      I've been making a lot of looses trying to make profit trading. I thought trading on a demo account is just like trading the real market. Can anyone help me out or at least advise me on what to do?

    • @ClaraWilson-s3o
      @ClaraWilson-s3o 19 дней назад

      Trading on a demo account can definitely feel similar to the real market, but there are some differences. It's important to remember that trading involves risks and it's normal to face looses sometimes. One piece of advice is to start small and gradually increase your investments as you gain more experience and confidence. It might also be helpful to seek guidance from experienced traders or do some research on different trading strategies

    • @Nedelcu-n3q
      @Nedelcu-n3q 19 дней назад

      I will advise you should stop trading on your own if you keep losing

    • @Nedelcu-n3q
      @Nedelcu-n3q 19 дней назад

      If you can, then get a professional to trade for you i think that way your assets are more secure

    • @Nedelcu-n3q
      @Nedelcu-n3q 19 дней назад

      I'd recommend Melanie Lasser her profit is great even when there's a dip

  • @elki_8
    @elki_8 2 месяца назад

    Thank you!! I got exams about exactly those patterns next week!

  • @thevibrationbaby
    @thevibrationbaby 20 дней назад

    You got my sub with freedom units - you might be the only self aware American out there.

  • @tiagodev5838
    @tiagodev5838 Месяц назад

    Great instructional video, thank you!
    Also, "Freedom Units" is one of the most American things I've ever heard haha!

  • @ramgopalvarma5949
    @ramgopalvarma5949 Месяц назад

    Crazy simple examples to remember, I just wish you provide more code examples

  • @ElHirani
    @ElHirani Месяц назад

    Thank u im new with these kind a type of things , cause i recently learn oop so this video help me a lot in any terms

  • @AmitabhSuman
    @AmitabhSuman Месяц назад

    Loved your explanation. Very interesting and simple. Tons of thanks!

  • @sebastianalfaro1887
    @sebastianalfaro1887 2 месяца назад

    i was needing this this morning haha, thanks dude!

  • @lindaporsius
    @lindaporsius 21 день назад

    Dear Sir. What you say is really worth it to put into separate videos. That way we could study them in a lower pace.

  • @lunardesigner6779
    @lunardesigner6779 13 дней назад

    I really love your explanation Man

  • @Slim_dev
    @Slim_dev Месяц назад

    Great Content Man!, please create more of these videos thanks a lot!

  • @ziacodes
    @ziacodes Месяц назад +1

    I watched you since you had 20K subscribers.
    Most underrated channel. Please show more code examples. That really helps us!

  • @cedi2929
    @cedi2929 17 дней назад

    Matthew McConaughey as dev 😅
    Great work! 👌

  • @juancriolivares
    @juancriolivares Месяц назад

    Great explanation. Beside these ones, I really like the decorator pattern.

  • @flyte9844
    @flyte9844 Месяц назад

    Exactly what I needed to watch ! Thanks !!

  • @codeman99-dev
    @codeman99-dev 2 месяца назад +24

    21:31 The notify private method is doing the wrong thing. It should be emitting an event that the subscriber can listen for. The whole point is that the acting class does not need any collection of who wants the result of the action. You emit the result.

    • @Kenny-st8cg
      @Kenny-st8cg Месяц назад +10

      Correct, I don’t think he really understands what the observer pattern is.

    • @Valrast1
      @Valrast1 Месяц назад +10

      Also, "we don't loop through"- we loop with foreach

  • @KyleLuce
    @KyleLuce Месяц назад

    Some framework strategies of dependency injection can be Singleton by default and are easier to test. For example Spring Singleton beans are easy to mock since the guarantee of being Singleton isn't language enforced (it's at a higher abstraction).
    If you do singletons the old fashion way it's indeed a pain to mock any Singleton or static implementation. Kotlin does make static and its object Singletons easier to mock using Mockk, but i believe there are still some pitfalls to avoid.

  • @AntonioPetrelli
    @AntonioPetrelli 26 дней назад

    Actually singletons, when got from a static method, can be easily mocked by Mockito with mockStatic method. You need to do some try-with-resources though.

  • @lutfiikbalmajid3128
    @lutfiikbalmajid3128 Месяц назад

    Hi, Your new subs here! i like your video, the way you explain, and some little jokes you put in this video haha

  • @mcstephen
    @mcstephen Месяц назад

    A Video i never knew i needed.
    Thanks alot, for real, thanks.

  • @trongnhantran3358
    @trongnhantran3358 16 дней назад

    Love the video right away at 10s

  • @taofeekakinkunmi8990
    @taofeekakinkunmi8990 Месяц назад

    I love the way you simply everything. kudos

  • @mpack235
    @mpack235 27 дней назад

    I'm schizophrenic( diagnosed) , i feel like i think like you or you think like me, when i solve problems or when imagining examples to articulate my problems!

  • @celestinenwachukwu919
    @celestinenwachukwu919 Месяц назад +3

    as a junior developer i felt like i peeked into heaven

    • @Aaron-tl9zy
      @Aaron-tl9zy 18 дней назад

      Bro I've known all of these for years now and I consider myself a jr haha

    • @KulaGGin
      @KulaGGin 3 дня назад

      Try Head First Design Patterns and Uncle Bob's Clean Code, Clean Architecture and also Uncle Bob's talks here on YT and then there's a whole video series on his website cleancoders.

  • @PatrickMeppe
    @PatrickMeppe 28 дней назад

    1:30 I have to disagree. The greatest pattern of all times is the Observer pattern. 🙂
    In my case I use the radio & antenna as an analogy to explain it to my students.

  • @lilgox3105
    @lilgox3105 Месяц назад

    You explain well the design patern...

  • @livreloui657
    @livreloui657 17 дней назад +1

    Simple and clear

  • @jaysonlabarrete9121
    @jaysonlabarrete9121 Месяц назад

    I love your analogies! I subscribed to

  • @lautidev_
    @lautidev_ Месяц назад

    Nice video, so easy to learn

  • @ashishsapkota945
    @ashishsapkota945 2 месяца назад +2

    I came to find out that I have been using most of those patterns without knowing what they were

  • @deltatee9050
    @deltatee9050 Месяц назад +1

    Amazing, loved the analogies, sample situations and code snippets which displayed the execution excellently!

  • @NicholasBond-r2e
    @NicholasBond-r2e 5 дней назад

    Should I create a whole other class as the Factory or could I make the creation logic inside a static method of the single class?

  • @kayakMike1000
    @kayakMike1000 9 дней назад

    Singletons are an antipattern. They create a dependency that everyone has to use thats kinda are just magically there.
    If you need a logger just let the user inject that logger. Its really that easy.

  • @luan5217
    @luan5217 Месяц назад

    Nice video! I would like to know what program do you use to diagram ;)

  • @pawel_890
    @pawel_890 2 месяца назад +4

    When can we expect a video of Rust on NixOS on Neovim?

  • @ImNotAshhhhhhh
    @ImNotAshhhhhhh Месяц назад

    I feel like a lot of the issues that design patterns resolve can be fixed with simple static classes with static methods

  • @diabeticnomad
    @diabeticnomad Месяц назад

    6:00 oh shit! That just solved a problem I had sweet thanks

  • @alexiosgaming6504
    @alexiosgaming6504 Месяц назад

    Bro this thaught me many things. Now i can too speak like i know everything about design patterns

  • @parttimewarrior5789
    @parttimewarrior5789 Месяц назад

    I don't know who this comment is for, but this feels like watching an Adam Ragusea video except about programming

  • @BooksWeCanRead
    @BooksWeCanRead 2 месяца назад

    100% want you to explain everything to me 😅💜

  • @Jonathan-zq8vs
    @Jonathan-zq8vs Месяц назад +1

    What are you using to diagram ?

  • @NebulaM57
    @NebulaM57 Месяц назад

    Freedom Units, I like that. :)

  • @braxeyy
    @braxeyy 5 дней назад

    would've been cool if you utilized the factory pattern for your strategy pattern example lol

  • @jovemdomma
    @jovemdomma Месяц назад

    great content bro!

  • @TAHppled
    @TAHppled 2 месяца назад

    I clicked subscribe as soon as he said “freedom units”.

  • @cris7775
    @cris7775 Месяц назад

    Love It, great explanation

  • @PavinWannasirilak
    @PavinWannasirilak Месяц назад +3

    18:24 Why will a lot of if-else if-else be gone? How can you know what type of the transport should be constructed without the control flow?