8 Design Patterns | Prime Reacts

Sdílet
Vložit
  • čas přidán 6. 06. 2024
  • Design patterns are really useful ;)
    ORIGINAL: • 8 Design Patterns EVER...
    Recorded live on twitch, GET IN
    / theprimeagen
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
  • Věda a technologie

Komentáře • 504

  • @NeetCode
    @NeetCode Před rokem +404

    Holy shit, theprimeagen reacted to me! 🤯 Love it

    • @wlockuz4467
      @wlockuz4467 Před rokem +20

      Thank you for 16:42 you damn comedic genius

    • @vidbina
      @vidbina Před rokem +2

      You've made it! Keep that neet code (and those neet takes) coming. 🏆🥳

    • @yungifez
      @yungifez Před rokem +1

      He just got you a new sub

    • @BurninVinyl
      @BurninVinyl Před rokem

      Man, the Java joke was fantastic!

    • @ericbwertz
      @ericbwertz Před 11 měsíci

      Whew, that one went your way... this time. :)

  • @Lambda.Function
    @Lambda.Function Před 7 měsíci +143

    Interestingly there are also functional programming patterns. I've got the full list here:
    1. Functions

    • @tablettablete186
      @tablettablete186 Před 3 měsíci +2

      I have been studying design pattern for some exams and this is just GOLD!
      Thank you for the laugh!😂

    • @johnmitchellvillanueva
      @johnmitchellvillanueva Před 3 měsíci +2

      That is all you need

    • @sameeranadgaonkar9756
      @sameeranadgaonkar9756 Před 2 měsíci +1

      Lol, I'm studying design patterns after studying some functional programming and this is what I just realised. Strategy pattern == first class functions, visitor pattern == pattern matching!

    • @evergreen-
      @evergreen- Před 2 měsíci +1

      True, Strategy pattern = higher order function, Iterator pattern = functor

    • @jkf16m96
      @jkf16m96 Před 2 měsíci

      Completely ignoring how functions can get other functions as an input, or even self-invoke them.

  • @betterinbooks
    @betterinbooks Před rokem +385

    2:48 - factory pattern
    4:38 - builder pattern
    6:36 - -singleton- arch user pattern
    10:03 - observer pattern
    11:40 - iterator pattern
    14:21 - strategy pattern
    16:09 - adapter pattern
    17:56 - facade pattern

  • @sealsharp
    @sealsharp Před 11 měsíci +180

    I love how some of the patterns are "wtf is that monstrosity" while others are "oh, that's a pattern? I thought that's basic doing things".

    • @hoi-polloi1863
      @hoi-polloi1863 Před 8 měsíci +28

      That's how the whole "patterns" thing started... a bunch of 4 guys were just trying to codify good ideas they'd seen so they could share them around. Things then... well. Things got a little out of hand.
      MyClassFactory myClassFactory = new MyClassFactory();
      MyClass myClass = myClassFactory.create();
      BWA HA HAH AHA HAHAH AHAH AHAAA

    • @Lisekplhehe
      @Lisekplhehe Před 7 dny +1

      I remember being asked which patter is a smart pointer in c++. I listed 3, before they told me it was a proxy and i was like yeah, i guess, but who cares?

  • @ericm97
    @ericm97 Před rokem +506

    Reasons I find these react type videos to be among the top best things to be happening to my career:
    1) I find out amazingly informative tech CZcamsrs from the original videos
    2) Primes constant interjections is basically 100x-ing the information
    3) He’s so f*in funny.
    4) This kind of gold only seems to flow from highly technical senior engineers in the creamy layer of companies
    Thanks prime, continue to make these !

    • @heavenstone3503
      @heavenstone3503 Před rokem +6

      Couldn't agree more !

    • @lookingjust987654321
      @lookingjust987654321 Před rokem +8

      No offense to prime, and he's about as good an engineer as it gets. People that write business apps adopt the OO things because its useful in that context. engineering for large scale isn't the right context. I know people making $300k a year building salesforce apps, and $300k a year building large scale streaming systems. Context.

    • @jglaab
      @jglaab Před rokem +12

      Constructive criticism: "Creamy Layer of companies" makes me uncomfortable 🥴

    • @TacoMaster07
      @TacoMaster07 Před 11 měsíci

      Reason # 5) You have brain damage.

    • @Oi-mj6dv
      @Oi-mj6dv Před 11 měsíci +1

      Agreed

  • @LogicEu
    @LogicEu Před rokem +755

    So many religions in software nowadays

    • @iritesh
      @iritesh Před rokem +9

      It's kinda weird ngl

    • @iritesh
      @iritesh Před rokem +1

      Even IRL religions don't make sense, let alone software religions

    • @BboyKeny
      @BboyKeny Před rokem +119

      Yeah, only religion that's valid it HolyC and TempleOS

    • @medaliboulaamail6491
      @medaliboulaamail6491 Před rokem +12

      Alahuakbar

    • @kdot78
      @kdot78 Před rokem +8

      @@BboyKeny long live the schizo god!!!!

  • @martinlutherkingjr.5582
    @martinlutherkingjr.5582 Před 3 měsíci +11

    Just realized 1994 is 30 years ago

  • @llave8662
    @llave8662 Před rokem +24

    (he works at Netflix btw)

  • @icemojo
    @icemojo Před rokem +146

    8:08 Well, as an avid Python programmer, I can vouch that while using decorators feels pretty nice (most of the time), writing them is an absolute mind numbing experience.

    • @ShadowKestrel
      @ShadowKestrel Před rokem +26

      same goes for rust macros: I love when they are provided but now I am writing them my sanity is simply not here any more

    • @BboyKeny
      @BboyKeny Před rokem +4

      @@ShadowKestrel I'm doing the proc_macro workshop and doing the derive(Builder) macro as my first 1 since yesterday.
      It's all fun and games, till I got to the optional-field part. I shudder at the realization that there are so many way to make a struct field optional and I would need to check all of them.
      I'm just starting out with it so there are without a doubt tons of pattern and tools to help with these kind of things that I don't know of.
      Although do think it's probably a very useful tool to have in my arsenal and way more powerful than macro_rules.

    • @ThatOpinionIsWrong
      @ThatOpinionIsWrong Před rokem +21

      Me: "How does decorator work behind the scenes?"
      Senior dev: "It just works"

    • @greglocker2124
      @greglocker2124 Před rokem +4

      ​@@ThatOpinionIsWrong with a smile on its face, that's how!

    • @Maric18
      @Maric18 Před 9 měsíci +1

      how a decorator works:
      you write a function that takes in a function and gives back the "same" function
      plus you can do code on the side
      def print_instead(func):
      return print
      will give you a decorate that replaces the decorated function with print :D

  • @cas97553
    @cas97553 Před rokem +31

    It would be cool to go through examples of patterns in rust. I haven't looked at the code for serde but it seems to use interesting patterns such as adapters to support different serialization formats.

  • @DryBones111
    @DryBones111 Před rokem +53

    I too love the strategy pattern. Higher order functions are the most beautiful way to do the strategy pattern. Functional programming is just the strategy pattern all the way down. I love the strategy pattern btw.

    • @iambilbobaggins1884
      @iambilbobaggins1884 Před rokem +8

      Do you love the strategy pattern?

    • @Gamester-vy1qp
      @Gamester-vy1qp Před rokem +11

      @@iambilbobaggins1884 I think he loves the strategy pattern... Can he confirm?

    • @ericbwertz
      @ericbwertz Před 11 měsíci +3

      @@Gamester-vy1qp I, too, wish I knew how he felt about this, and where/if he works.

    • @Hytpu9
      @Hytpu9 Před 9 měsíci +6

      i was a bit confused at the begining of your message - does he rly love the strategy pattern, but at the end I put aside my doubts - you DO LOVE STRATEGY PATTERN!

    • @vikingthedude
      @vikingthedude Před 7 měsíci +3

      Bro. I think you love the strategy pattern

  • @hamzahmd_
    @hamzahmd_ Před rokem

    I first thought it was about PrimeReact UI Library.
    Your videos are fun to watch; I've subscribed.

  • @alexcook4851
    @alexcook4851 Před 6 měsíci

    love the design patterns book, great video!

  • @PasiFourmyle
    @PasiFourmyle Před 8 měsíci +2

    CZcams REALLY wanted me to watch this, popping up on my end screens and recommended list for like 2 weeks now. I finally watched it..... sadly I'm not far enough on my coding journey to have learned anything or understood what was going on other than the great Prime jokes🤣

  • @mattwilliams1844
    @mattwilliams1844 Před rokem +13

    Singletons are really nice for hardware abstractions in embedded systems. For example I only want one instance of my keyboard structure, not 2 or 20.

    • @potaetoupotautoe7939
      @potaetoupotautoe7939 Před 8 měsíci +3

      I actually want 20, one for japanese , English and macro all in 1 keyboard

  • @highlanderdante
    @highlanderdante Před rokem +120

    are we going to just ignore the fact that he's using camelCase on Python?

    • @tablettablete186
      @tablettablete186 Před rokem +9

      ​@Chase Miller snake_case >>>>> everything else

    • @judewaide8328
      @judewaide8328 Před rokem +12

      ​@@tablettablete186 camel case is the only way

    • @tablettablete186
      @tablettablete186 Před rokem +2

      @@judewaide8328 oBjEcTivALy WRONG!!! 😤
      (I wanna where this goes 😅😅😅)

    • @judewaide8328
      @judewaide8328 Před rokem +1

      @@tablettablete186 lol

    • @jamesgood7894
      @jamesgood7894 Před rokem +9

      @@tablettablete186 snake_case gang

  • @mechantl0up
    @mechantl0up Před rokem +2

    I use the builder pattern for all my JS Web Components. I am surprised people are surprised at returning this. It works nicely with a functional style, too, with a builder class whose final commit returns a DOM node and other methods return this. The web component then basically builds as one function call that when returned returns the ready component.
    You may get away with using not a single if else for a full and fully parametrised component with ES6 if returning this from each build method except commit. Listeners and any other features are just properties inserted with the builder as each sub component is described by joining build calls with the dot notation. The build tree will thus extrapolate to any complexity, as a component can always comprise any of the builds, which can comprise any builds, and so on, till the call stack returns to the top level and a full HTML component with any child components is returned, and is inserted in the DOM with the final commit. In theory, the whole web page could be built thusly.
    Prettier than some React stuff I have seen.

  • @Leto2ndAtreides
    @Leto2ndAtreides Před rokem +3

    I usually think about the Facade pattern in terms of delineation between groups of developers, or major functions in an app... But one could just consider it a part of UX (or DX) → You make stuff easier to communicate, understand, and use.
    I wouldn't think of it normally as an endpoint though - unless you were explaining the endpoint with docs in a "This is all you need to know to do this" sense.
    But I think that perspective comes from seeing Facades as typically being a class with clear features, and not just any point that simplifies interactions between one system and other systems.

  • @sphesihlemanuel2933
    @sphesihlemanuel2933 Před rokem +2

    Bro I watch your videos everyday huge respect . I learn lot here .

  • @josephp1263
    @josephp1263 Před 10 měsíci

    I love how straight to the point reactions Prime Reacts have

  • @TechBuddy_
    @TechBuddy_ Před rokem +5

    I don't know why but I crave more of these 💓💓

  • @maxteer2800
    @maxteer2800 Před rokem +9

    I'm gonna take a shot every time you mention you work at Netflix

  • @axelfoley133
    @axelfoley133 Před rokem +12

    Video: Screw too small for the hole.
    Primeagen: We've all felt this...
    Me: I thought the idea was you couldn't feel it.

    • @TehKarmalizer
      @TehKarmalizer Před rokem

      You know what you should feel by knowing what you don’t feel.

  • @khhnator
    @khhnator Před rokem +10

    the idea of patterns is great.
    how people found patterns and tried to put everything in a pattern shaped hole was not.
    specially when "patterns" became some sort of bizarre synonym of OOP

    • @avwie132
      @avwie132 Před 8 měsíci +2

      When someone confused patterns with OOP and confused OOP with classes it is quite difficult to take them seriously

    • @ethanwasme4307
      @ethanwasme4307 Před 7 měsíci

      ​@@avwie132i don't program, they come off pretentious at the least 😢

  • @thekwoka4707
    @thekwoka4707 Před rokem +2

    The way Prime talks about his little Netflix local server box thing is like how a white girl talks about that one semester she studied abroad in Barcelona.

  • @nevokrien95
    @nevokrien95 Před 9 měsíci

    I did use a factory on my own.
    Needed to make a bot object that needed to load a few things from files assorted with a user Id.
    It was actually a ton of fun

  • @jma42
    @jma42 Před rokem +1

    im a bit new to design patterns, and ive been struck into the type state pattern from rust, is type state pattern also a form of builder pattern?

  • @fedeanastasis7040
    @fedeanastasis7040 Před rokem +29

    I'm just about to suggest in my project to start using a Factory for a single reason. We have 5 different classes that create the same object using a builder BUT it isn't clear how many fields of that class have to be set up(spoiler all of its parameters so always the complete builder). To isolate in a single place how the creation of that object has to be, enforce validations and ensure one of the fields that is a map is always created correctly depending on 1 of those 5 usecases. If not we will snowball into having distribuited the creation logic across multiple places

    • @CottidaeSEA
      @CottidaeSEA Před rokem +9

      And *that* is what factories are made for. To unify and hide away complexity from the developer who shouldn't have to worry about that stuff, and you still need to have some unified way to create everything.
      Oh, and I dislike factories (honestly not too keen of builders either) so I have every reason to absolutely shit on them. It's just that in some cases they actually do make sense. They are simply abused to infinity and beyond.

    • @NihongoWakannai
      @NihongoWakannai Před rokem +8

      @@CottidaeSEA i feel like this how it goes for a lot of patterns. We hate them because of how they get misused, but by god they are very useful in their actual niche.

    • @wadecodez
      @wadecodez Před rokem +2

      don't use a builder or factory if instantiation params are wonky/unknown. you should consider writing a context object. then any methods/classes that have the wonky/painful params pull from a single source. you'll see this a lot in JS when working with large libraries. There will usually be a single settings object which describes how the library should behave.
      The key to keeping settings objects maintainable is making them immutable. Once you allow mutations to settings, you are no longer passing around context, you are passing around state. immutable context is predictable state is not.

    • @CottidaeSEA
      @CottidaeSEA Před rokem +1

      @@NihongoWakannai Yeah, I feel like that also translates to OOP getting a lot of undeserved hate.

    • @CottidaeSEA
      @CottidaeSEA Před rokem +1

      @@wadecodez Doesn't that pattern also use a factory? I've never seen it without a factory at least.

  • @holthuizenoemoet591
    @holthuizenoemoet591 Před rokem +5

    the arch user strategy pattern sounds interesting

  • @MihoKozloffsky
    @MihoKozloffsky Před rokem +2

    The idea of a factory is to provide only one interface create so client class could use it to create object of given interface. Like when you need some default value (like in data classes) when constructing object.

  • @alienm00sehunter
    @alienm00sehunter Před rokem +1

    I usually prefer default in Rust over the builder pattern. I do emit part of this is because it's a lot easier to implement. I don't normally mind using the builder pattern but I hate programming it. Also I feel like it doesn't normally have much of a benefit so I don't know if it's worth implementing in most cases.

  • @techsuvara
    @techsuvara Před měsícem

    Reactive programming works a lot with Observer, Iterator and Strategy patterns. For some historical insight, it's called RX because Microsoft did a lot of work with something called Reactive eXtensions, hence it evolved to RXJava.

  • @StuartLoria
    @StuartLoria Před 10 měsíci

    First video from this guy that I like

  • @porky1118
    @porky1118 Před 10 měsíci +1

    16:30 I recently had a similar problem.
    My solution was buying bigger screws.

  • @porky1118
    @porky1118 Před 10 měsíci +3

    15:00 That's why I hate pattrens. They give things I do everyday, which aren't special to me, names, and call them patterns. And I'm supposed to know these patterns now.
    I had no idea what the strategy pattern is. I just pass functions to make my code more generic and that's it.

    • @sch3me521
      @sch3me521 Před 3 měsíci +1

      I feel the same way. They're patterns in the sense that they appear a lot but I think the moment you start naming then and teaching useless toy examples to people they go from "common problem solving technique" to "tool I need to know and fit in my code somehow". I swear software engineering is the worst thing that has ever happened to programmers

  • @DagarCoH
    @DagarCoH Před rokem +1

    Saw the original before, generally good comments as far as my experience with these patterns go.
    One critique I have is your statement that "Everything is a facade, becaus you hide information" with something something private. Facade does obfuscate variables and functions from the programmer, but they are still accessible from the outside. Basically, Facade (at least as stated in the GangOf4) is an interface to a functionality that says "Hey, 99% of the time, you will want to use me by calling these couple of functions here. If you need more custom behaviour and you REALLY know what you are doing, you can also tweak all my other variables and use these other functions". So Facade gives you a set of convenient functions to use it with, but also allows for access to everything else about the interfaved functionality, if you want to.

  • @Jay-kb7if
    @Jay-kb7if Před 11 měsíci

    I have a question, I came about a pattern like the strategy pattern. This is more for lists being built and need ordering/fitlering. instead of removing elements, I made a reference to an array of int for each item and I just reorder that. It feels like if you don't add or remove elements or make it stale, it is the best performance/granuarlity in modification. I just iterate over the original list and ignore depending on conditions, and then from 0 add that to the reference index, leaving the unwanted indecies at the tail. If I screw up or need to reverse, just reset it to 0, 1, 2, etc. One issue is that the unwanted elements are at the tail, but I gues it depends on use cases. So am I walking into a nightmare? it seems much nicer than previous methods.

  • @jogewe
    @jogewe Před rokem +3

    I loved head first design patterns 🥰

    • @akshay-kumar-007
      @akshay-kumar-007 Před rokem +1

      The book is just so awesome. The way they teach design pattern by first introducing the problem and slowly building up the solution is great!

  • @tech3425
    @tech3425 Před rokem +10

    That casual "when I was at Google" also got me going "weird place to flex, bud" 😂

  • @nandomax3
    @nandomax3 Před rokem

    I love the builder pattern, it's so useful. And the factory pattern is also super helpful

    • @aoeu256
      @aoeu256 Před 11 měsíci

      In Python keyword arguments and dictionaries tetrisgame(func1={arg1: 5}, object2={arg2: object3}) can replace builder pattern...

    • @night23412
      @night23412 Před 11 měsíci

      ​@@aoeu256can you elaborate?

    • @TheEVEInspiration
      @TheEVEInspiration Před 7 měsíci

      It is only useful when you need to control what actually gets instantiated or how it gets configured during or after constructing.
      In all other cases, just doing a "new" of the proper class is both simpler and easier to follow.
      So if there is this need, sure, go for it.
      But I will never consider it a pattern to default to.

  • @doomguy6296
    @doomguy6296 Před 9 měsíci +2

    Python decorators are the best. They are the easiest form I saw for metaprogramming. It is really easy to read and understand the logic behind them

  • @andrews8733
    @andrews8733 Před rokem

    Command and Observer are my personal favs

  • @v1Broadcaster
    @v1Broadcaster Před rokem

    this channel is my favorite netflix advertisement

  • @thirdvect0r
    @thirdvect0r Před rokem +1

    builder pattern with rust is good because of the TypeState Pattern

  • @lorenzodrea4640
    @lorenzodrea4640 Před rokem +1

    > Buys patterns book
    > Looks inside
    > Interfaces
    > 😐

  • @seans4290
    @seans4290 Před 9 měsíci

    This is exploding my brain - ive had such a hard time listening to other peoples coding videos. Not this, im fully engaged. Thank you!

  • @ISKLEMMI
    @ISKLEMMI Před rokem +1

    8:25 - What is this contraption??
    16:18 - ngl this caught me off guard mid drink

  • @c4tubo
    @c4tubo Před 9 měsíci +1

    Common confusion: Observer is not Pub-Sub. Observers listen directly to their Observables/Subjects, so then each Observable/Subject must keep references to all of its Observers and become bound to their lifetimes. Publish-Subscribe adds one more level of indirection by having publishers and subscribers both depend directly upon a Channel between them; therefore they are tied to the lifetime of the channel rather than each other. Subscribers only become aware of publishers when notified with a message that provides the reference to the publisher if necessary.

  • @asimssheikh
    @asimssheikh Před rokem

    Whats the link to the original video being reacted to?

  • @T1Oracle
    @T1Oracle Před rokem +2

    The only reason to use a factory is to hide the complexity of object creation. If a design pattern does not result in simpler code, then you are using the wrong design pattern.

  • @celiacasanovas4164
    @celiacasanovas4164 Před 8 měsíci +2

    Observer, Iterator and Strategy are great. Singleton is ok if you're careful with state (Rx singleton Observable for instance). Adaptor and Facade are unavoidable, but I hate how coupled they can get. Factory and Builder are meh - I feel they're needed sometimes but they get overused. ps. lol at Primer reacting to Python OOP in real time

  • @first-thoughtgiver-of-will2456

    Iterators in java: sugar
    Iterators in Rust: honey
    Iterators in python: 8 year old stevia packet

  • @JohnWasinger
    @JohnWasinger Před rokem

    17:45 Adapter pattern is just the application of a strategy pattern.

  • @teotwawki1101
    @teotwawki1101 Před 4 měsíci +1

    Can you not say "okay google" while I'm driving? It pauses the video! :p

  • @volodymyrlanko1663
    @volodymyrlanko1663 Před měsícem

    By the way, if you guys didn't know that... he works at Netflix

  • @kiffeeify
    @kiffeeify Před rokem +4

    I think the Singleton pattern as just a special case of "execution contexts" where there is only one global context.
    It can simplify code by removing the need to explicitly pass down dependencies into the callstack.
    However, as with all static globals, it creates global coupling.
    staying with the python example from the video I would always rather use a construct as below instead of a singleton:
    ```python
    with some_context_of_type_y():
    with some_context_of_type_x():
    foo()
    def foo():
    y = get_y_object()
    x = get_x_object()
    ```
    IMHO it gives better composability on the outside scope and has the same advantages as singletons on the inside scope.

    • @ThomasZero288
      @ThomasZero288 Před 8 měsíci

      Yea there are very few scenarios to actually use this pattern once you have DI, in fact it only interferes with/breaks DI. The only two examples I can think where I would actually use it are A) a tiny app where I'm not going to include an IoC library or B) In the very initial boot of your app when the IoC container/AppContext is either half constructed or has not finished initializing and is in an unsafe/incomplete state, yet you still need access to critical components like a preInit logger.
      Cause if AppContext fails to initialize... and that's where you get your logger from... and you want to log the error... and it IoC fails to initialize.... so you want to log it... but it has the..... wait.. where was I? where am i? WHO ARE YOU PEOPLE???? Can someone call my mom, im scared

  • @armynyus9123
    @armynyus9123 Před 6 měsíci

    As a netflix btw guy Prime could/should have really said a bit more about the observer pattern. ReactiveX was a live changer for me, and that netflix talk about it sold it to me, back then.

  • @eirenepark4657
    @eirenepark4657 Před rokem

    The strategy seems useful but when would be a good time to use it compared to just having a regular function in the example it uses it strip out odd or negative numbers which you can just do with a function and it will be more easily understood i guess?

    • @airman122469
      @airman122469 Před rokem

      The exact example they gave could have used a lambda as an argument.
      But in cases where more complex operations need to take place, but the inputs must be the same across invocations, then a strategy pattern is useful.

  • @metacarpo10
    @metacarpo10 Před rokem

    Primogen really souds like a young Rick, from Rick and Morty. I dont have time for making this but just close your eyes and imagine it. Add some burps and voila. I think its the rhythm.

  • @naranyala_dev
    @naranyala_dev Před rokem

    Top tier dev reaction videos 🌟🌟🌟🌟🌟

  • @JJ-hb9in
    @JJ-hb9in Před 4 měsíci

    “Patterns” is just something to grab if you don’t have lambda, the ultimate abstraction

  • @bonecircuit9123
    @bonecircuit9123 Před 10 měsíci

    cmon man, i need an outro spaz!

  • @kodekata
    @kodekata Před rokem

    Great comment at 15:48 . From a functional perspective, the "interface" you are crying out for, is just a function.
    However I don't think it's worth a full fedora-tip here, because as competent engineers we need to be prepared for any situation we may walk into. Such as George Clooney walked into in From Dusk Till Dawn.

  • @joshuawinters-brown4831
    @joshuawinters-brown4831 Před 10 měsíci +1

    In gonna take a shot every time you say you work at Netflix from now on 😂

  • @eafadeev
    @eafadeev Před 8 měsíci

    we need more abstract builder factories producing abstract builder factories.

  • @jalalbmnf
    @jalalbmnf Před rokem +2

    Blaaaazinglyyyyyy

  • @sameeranadgaonkar9756
    @sameeranadgaonkar9756 Před 2 měsíci

    he looks so guilty when talking about factories :P

  • @TsoiIzAlive
    @TsoiIzAlive Před rokem

    self head had me out of order for 1 hot minute !

  • @htrOfLiesfub
    @htrOfLiesfub Před rokem +2

    This video was good. Why? We learnt something, unlike some videos where you just rant or do irrelevant optimisations, in this I actually learnt something which can get someone hired.

    • @ericbwertz
      @ericbwertz Před 11 měsíci

      Rant material is often a flash-forward to a problem or conflict that you just haven't run into YET -- artifacts of some clear, prior trauma.

  • @sealer1675
    @sealer1675 Před 6 měsíci +1

    14:00 I don't think you're supposed to raise exceptions on regular functionality (reaching the end of the list)

  • @AceofSpades5757
    @AceofSpades5757 Před rokem +20

    Decorators are one of my favorite things about Python. They're so fantastic.

    • @banatibor83
      @banatibor83 Před rokem

      One of the most useless language feature :) They have very limited use if you do not want to end up with totally unreadable code.

    • @grantpeterson2524
      @grantpeterson2524 Před rokem +1

      I used to dislike decorators, but I'm currently working in C# (which doesn't have them) and I keep running into instances where it would be really nice...
      I have a class that makes API calls asynchronously, but I need to limit the number of async calls being made at a time. So, I need to use a semaphore to force threads to await if all the other threads have used up the semaphore. Would be super nice to just use a decorator at the top of every method that makes an API call so that it wraps the execution with an await to the semaphore, but not an option for vanilla C#. I ended up creating another class called RequestExecutor that has methods that take lambda functions and do this instead, but it feels less clean.

    • @aoeu256
      @aoeu256 Před 11 měsíci

      @@banatibor83 If you think decorators are bad, what about the abstractfactory patterns here. They are used for black-box aspect oriented programming to simplify your code, and are in JavaScript as well.

  • @zwanz0r
    @zwanz0r Před 3 měsíci

    I'm actually teaching this book twice a year

  • @occo5877
    @occo5877 Před 8 měsíci

    Can you talk about react component patterns ?

  • @FaceBookAutomated
    @FaceBookAutomated Před 9 měsíci +1

    Can you dump full vods as well? I’d like to re-experience everything from the stream.

  • @shaunmolloy_
    @shaunmolloy_ Před 11 měsíci

    Laughed at the, "is this bash now!?" comment 😂

  • @MihoKozloffsky
    @MihoKozloffsky Před rokem

    BTW2 example of factory is actually example of facade

  • @im-a-trailblazer
    @im-a-trailblazer Před rokem +3

    This guy is intense. But i think he works at Netflix right?

  • @byronservies4043
    @byronservies4043 Před 11 měsíci

    I had that book. I tore it apart before I trashed it so nobody else would be infected by it.

  • @v1Broadcaster
    @v1Broadcaster Před rokem

    one day will arch users will graduate to gentoo then RHEL followed by LFS or are they not good enough?

  • @porky1118
    @porky1118 Před 10 měsíci

    19:00 I expected facade being something like "struct NodeId(usize);"
    Internally it's just an integer, but you can't use it like an integer.

  • @willvincentparrone3339

    It would be nice too if I can get to know more about the developer who made this video

  • @Santa1936
    @Santa1936 Před 3 měsíci

    Some of the patterns are so ubiquitous that you almost don't need to know them. Like I don't need to know that air is called air because I just breathe it naturally

  • @peterndungu41
    @peterndungu41 Před 10 měsíci

    We use singletons alot when writing a gamemanager

  • @henrykkaufman1488
    @henrykkaufman1488 Před rokem

    When I try Observer i end up with events of things that happened in reaction to some other event and stuff happening in random order and it turns out order matters and everything goes to sh*t what am I missing?

  • @ruisantos1037
    @ruisantos1037 Před rokem

    is he drinking mop water? great video btw

  • @FredoCorleone
    @FredoCorleone Před 11 měsíci

    "Can we pause for a second? I hate decorators"
    Hahahahaha

  • @tamtrinh3154
    @tamtrinh3154 Před rokem

    till now, i don't no crap about programming styles and patterns, I'll code whatever works

  • @dromedda6810
    @dromedda6810 Před rokem

    6:36 Trueeeeeee, btw i use arch and DWM

  • @norcal6181
    @norcal6181 Před rokem

    The pattern of choice at my job: The Spaghetti Pattern

  • @AlexRodriguez-gb9ez
    @AlexRodriguez-gb9ez Před 19 dny

    The factory pattern for this isn't needed you can just do this: Burger.Vegan = lambda **kwargs: Burger(ingredients=['special sauce', 'salami'], cook=lambda: Grill(temp=50, **kwargs), **kwargs)

  • @CrackThrough
    @CrackThrough Před rokem

    "lose your hair slowly" pattern lmao

  • @tricky2014
    @tricky2014 Před rokem +2

    The implementation of the linkedlist iterator in the video is actually faulty. If you would create two iterators they would actually both modify the object.

  • @TheNewton
    @TheNewton Před rokem +1

    Developer-Experience is the missing pattern category.
    17:55 Facade is a DX pattern for every clean http endpoint , convenience functions , the porcelain over the plumbing.

  • @redlancer7263
    @redlancer7263 Před rokem

    "I hate decorators" had me rolling

  • @zerosandones7547
    @zerosandones7547 Před rokem +1

    beginner question:
    what's the difference if I just use: new Burger("bun-type", "patty-type", "cheese-type"); vs the builder pattern?

    • @zachmanifold
      @zachmanifold Před rokem

      The main difference is if there's a varying amount of options when building an object.
      Say that I'm a really weird person and only want a burger with only a bun (no patty or cheese). Then I can use burger = BurgerBuilder().addBun().build()
      Or if I only want bun with cheese (no meat), burger = BurgerBuilder().addBun().addCheese().build()
      Otherwise you'd need several different constructors to handle every possible combination (which quickly gets messy when multiple options are involved.)
      The burger example is not the greatest to show this difference but hopefully that made some sense

    • @aoeu256
      @aoeu256 Před 11 měsíci

      the code is in Python but you used the new keyword hahah. You don't need builder in Python cuz of default arguments, keyword arguments and dicts in Pythons.

    • @zerosandones7547
      @zerosandones7547 Před 11 měsíci

      @@zachmanifold ooh,, now that you said something about those constructors, I got it now, thanks! :)

  • @akam9919
    @akam9919 Před 7 měsíci

    That opening was like a man confessing adultery to his wife.

  • @HrHaakon
    @HrHaakon Před 9 měsíci

    I am convinced that the US has a different Java than the rest of us.
    The only place I know of that has abstract factories are frameworks like Spring.
    Because Spring can make a case for "I need to have a way of producing objects of whatever type specified", as well as "and I need to allow more than one way of doing it".
    And that's just because of the very generic way the IoC-container works.

  • @ov1kenobi663
    @ov1kenobi663 Před 7 měsíci

    4:20; Composition over Inheritance

  • @evanhowlett9873
    @evanhowlett9873 Před rokem +5

    Design patterns in functional programming:
    strategy pattern: functions
    builder pattern: functions
    observer pattern: functions
    adapter pattern: believe it or not also functions

    • @aoeu256
      @aoeu256 Před 11 měsíci +1

      Builder pattern is record syntax + functions, adapter is record of functions.

    • @evancombs5159
      @evancombs5159 Před 9 měsíci +1

      Functional programming uses functions instead of objects, this checks out.

  • @hugo-garcia
    @hugo-garcia Před 11 měsíci +1

    Netflix is implementing java today