Loose Coupling & Dependency Injection the EASY Way! 🐍

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 45

  • @AndreasJung
    @AndreasJung 9 หลายเดือนก่อน +4

    Congratulations on starting your own channel. Always love your unconventional style :-)

  • @stevie_mac
    @stevie_mac 9 หลายเดือนก่อน +14

    For anyone not familiar, Hynek has written some incredibly well designed libraries like structlog. I use several of his libraries every day.

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      thank you for your kind words! 🤭

  • @sfermigier
    @sfermigier 9 หลายเดือนก่อน +3

    Fantastic video, clearly explains the basics. I have added it to my "Awesome Dependency Injection in Python" page (alongside other resources and many frameworks and libraries in Python).

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      Thank you so much! 💜

  • @joelffarthing
    @joelffarthing 9 หลายเดือนก่อน +1

    You have your reasons for thinking you may need shorter videos, but I found this to be a great length. You delivered information with examples that I can use immediately. This was just 'in-depth' enough without getting lost in the weeds. You cleared up my misunderstanding about Service Location; It is not inherently bad, but WHERE you use it matters. I really enjoyed your PyCon Talk and related article 'Subclassing in Python Redux'. Looking forward to more useful content. Thanks Hynek!!

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      Thank you!
      I don’t particularly mind making longer videos (they’re still much shorter than my conference talks!), my problem is that I’m kinda punching above my weight here! I shouldn’t need 2 months for 14 minutes of video -but I lack the skills to be faster even at this quality level.
      Therefore, I should be churning out videos to get practice and find my style. In that sense, I’m both blessed and cursed by an existing audience. :) I’m not producing videos for the void which feels GREAT, but I also hold myself to higher standards than if my videos had like 65 views.

  • @brenok
    @brenok หลายเดือนก่อน

    Just stumbled over your channel. Keep up the original style. There is charisma. The charisma of a software craftsman that knows his shit and has passion for it. That's the kind of person I love working with. Liked and subscribed :)

    • @The_Hynek
      @The_Hynek  หลายเดือนก่อน

      Thank you for finding and appreciating my backcatalog! That video specifically is very dear to my heart. :)

  • @zelozejn
    @zelozejn 9 หลายเดือนก่อน +2

    Very nice.

  • @AbdolaMike
    @AbdolaMike 2 หลายเดือนก่อน +1

    Great channel and great content cant wait to see moe!

  • @knolljo
    @knolljo 8 หลายเดือนก่อน +1

    Protocol is soo underrated, I recently rewrote a library first defining all Protocols and then could go on writing implementations, which was so much easier than the other way around

  • @hirolau
    @hirolau 8 หลายเดือนก่อน +1

    Keep posting videos! They are great so far!

  • @tamirbahar
    @tamirbahar 9 หลายเดือนก่อน +2

    Great video, thanks!
    The content is great, and even as an experienced programmer it's nice to see someone explain it all clearly. And the quality of the video itself, regardless of content, is really good too.
    Looking forward to the next one!

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      Thank you! 💜

  • @Agnostic080
    @Agnostic080 9 หลายเดือนก่อน +2

    3:07 nice reference to fear and loathing in las vegas!

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +2

      The two bags of grass, seventy-five pellets of mescaline, five sheets of high powered blotter acid, a salt shaker half full of cocaine, and a whole galaxy of multi-colored uppers, downers, screamers, laughers... the quart of tequila, the quart of rum, the case of Budweiser, the pint of raw ether and the two dozen amyls had to pay off eventually!

  • @miketheman
    @miketheman 9 หลายเดือนก่อน +1

    I really appreciate the distinction of the concepts vs tools, as so many folks have been introduced to a concept by using a tool. Since so much of software engineering is discovered through practical use, what other concepts might you explore to decouple from tools?

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      That's an interesting question! For me DI landed on my plate naturally because I realized how whenever I talked about DI in context of svcs, people talked about DI _frameworks_ to the point that it annoyed me. :) But I'm sure there's more!?

  • @Stubatigerful
    @Stubatigerful 8 หลายเดือนก่อน +3

    The feeling of actually learning und understanding something greatly overshadow any mic hits or so, you are an awesome source of knowledge Hynek

    • @The_Hynek
      @The_Hynek  8 หลายเดือนก่อน

      You’d be surprised how pedestrian my own use of attrs is! Sometimes I think I could just use dataclasses but I always run into some last 1% that’s annoying. :)
      Clean architecture is mostly about DIP, so this video is basically already the core. :D

  • @flamy111
    @flamy111 9 หลายเดือนก่อน +2

    "An example of Factory, Factory Factory you found under your bed as a kid..." That's a big problems with everything -- having good, concise examples that don't over-complicate everything even further.

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน

      Yes, although it's also part of things "finding their place". The original context of DI were ancient Java and .NET and concepts just have to ripe sometimes and be considered in new contexts. Which is what I'm trying to do. :)

  • @HelloForeignWorld
    @HelloForeignWorld 9 หลายเดือนก่อน +1

    The language of choice have pretty significant impact on the concepts you are able to adopt with it without inflicting pain on yourself and others. Adding some magic annotations that do things during runtime is a risky business, because you will never know if your thing works until you run it. Unit tests with mocked dependencies will obviously not prove that your thing is running fine when the real dependencies are assembled. Passing arguments to your functions is fine for 2-3 dependencies, but it will quickly become pain once your application grows.
    Having DI framework that does compile time checks that it can build your DI tree is a real time saver and creates great confidence and ergonomics for you. Such libraries are quite few for statically typed languages and unfortunately non-existent for dynamically typed languages 😅 (since there are no compile time checks). So far the best example of such DI approach is built in Scala's ZIO library. I can recommend 👍

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +2

      FWIW, some dynamic languages including Python have static types now and we even got a type-safe DI framework: github.com/Tinche/incant
      My service-locator that I mention is also type-safe. :)

  • @richtea43
    @richtea43 6 หลายเดือนก่อน +1

    "... even if you use global variables, like an animal" had me laughing. Who says Germans have no charisma? Oh, wait... Hynek did 😂 Anyway, you got me to subscribe

  • @anze3db
    @anze3db 9 หลายเดือนก่อน +1

    I love DI, but I've also seen it misused to the point that it made it impossible to follow the code without a debugger. Keep your dependencies as simple as possible, and remember that if your dependencies also have multiple dependencies injected, you will have a very bad time.

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +2

      Sounds more like a critique of DI frameworks than of DI. ;)
      One of the upsides of DI as presented is that it ADDS clarity where those dependencies are coming from in the first place.

    • @anze3db
      @anze3db 9 หลายเดือนก่อน

      ​ @The_Hynek it's probably more of a critique of that particular codebase than anything else 😅 Still, when you use DI that gets determined at runtime you lose the ability to cmd+click through the code flow. It is not an issue for things like db connections since you rarely have to walk through functions like .execute(), but it can be an issue if you use DI for the code you are now trying to debug.

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      Interestingly enough, this is more of an argument against DIP/interfaces than DI. You can totally make your arguments cmd-clickable if you use concrete types.
      I wonder how much anger against DI is misguided anger against DIP (= general musing, not against you :)).

    • @anze3db
      @anze3db 9 หลายเดือนก่อน

      @@The_Hynek Yeah, I should have been writing DIP instead of DI the whole time! For me personally dependency injection is too much of a fancy word for just passing an object through function arguments. There *has* to be more to it. Definitively some misguided anger there :)

  • @MurtagBY
    @MurtagBY 9 หลายเดือนก่อน

    I would zoom you out a little. We usually have a little wider fov when looking at a person

    • @MurtagBY
      @MurtagBY 9 หลายเดือนก่อน +1

      Great vid btw, I am glad to see your content!

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      I would too if I had more space. ;) Note how there’s a piece of a door left and a picture top right when max zoomed out :-/

    • @MurtagBY
      @MurtagBY 9 หลายเดือนก่อน

      ​@@The_Hynek
      Me and my wife is prepping for a baby and we are doing renovation work at place of my mother-in-law. So my room is stuffed extremely dense and I am at maximum blur at all calls. So I am on the same page, haha

  • @aliakbarsaleh382
    @aliakbarsaleh382 9 หลายเดือนก่อน

    Moin moin aus Hamburg 😁

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      🐻👋🐟😜

  • @cabc74
    @cabc74 8 หลายเดือนก่อน +1

    I downvote every single video that promotes a VPN service, no matter how good the content is or how much do I like the youtuber. This is one of those rare ocations in which a youtuber talking about VPN services at the end of a video made me to like the video and subscribe to the channel.

    • @The_Hynek
      @The_Hynek  8 หลายเดือนก่อน

      Glad to hear I'm not the only one with that particular pet peeve!
      Just hoping the contents is somewhat interesting too tho. 😅🙈

    • @cabc74
      @cabc74 8 หลายเดือนก่อน +1

      ​@@The_HynekI have watched 2/3 of your videos and they are the most underrated videos in TH-cam!

  • @SylvainSoliman
    @SylvainSoliman 9 หลายเดือนก่อน +1

    Poor mic…

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      I will need to find a better setup. 😅

    • @paulweveritt
      @paulweveritt 9 หลายเดือนก่อน +1

      @@The_Hynek I've spent a lot of time getting to know mics. My take: your mic is fine.

    • @The_Hynek
      @The_Hynek  9 หลายเดือนก่อน +1

      he means the incessant mic punching :)
      Currently, I have the problem that the moment I start moving my arms to be less of a statue, there's an elevated risk of hitting the mic and people think someone is knocking on their door. ;)

    • @ZleFox
      @ZleFox 9 หลายเดือนก่อน

      @@The_Hynek I am using headphones and the mic is adequate. Don't let it bother you too much.