justforfunc #29: dependency injection in a code review

Поділитися
Вставка
  • Опубліковано 10 лют 2025
  • Dependency Injection (aka Inversion of Control) is a great technique to write code that is easier to reuse and test.
    In this episode we review github.com/ger... and as a result create a pretty large PR: github.com/ger...
    References:
    PR: github.com/ger...
    Dependency Injection: en.wikipedia.o...
    filebuffer: github.com/mat...
    proposal on bytes.Buffer.Seek: github.com/gol...

КОМЕНТАРІ • 42

  • @shibasispatel6624
    @shibasispatel6624 6 років тому +4

    Your code reviews videos are bridging the gap between the theoretical aspects and the practical aspects, how they are being implemented. Keep making such awesome videos.

  • @MrGreen-kq4ds
    @MrGreen-kq4ds 4 роки тому

    my favorite format - i learn a lot by going through code review process with clear explanation and examples.

  • @arturszilgalvis6633
    @arturszilgalvis6633 6 років тому +1

    Well Go you!
    Watching you do the go, is really an symfony orchestra for me brain, beautiful.

  • @rsrini7
    @rsrini7 6 років тому

    Great. Wish every other tech youtubers should follow your way of code review live ... Learnt a lot lot.. thanks.

  • @moitoius
    @moitoius 7 років тому +5

    The reason for separate read/write file is probably because seek is stateful. If you write from one thread and read from another there is a good chance that you will corrupt the file. However, two threads concurrent writing will corrupt the file (two concurrently reading threads will read corrupt data) - so a mutex would have probably been best anyway.

    • @JustForFunc
      @JustForFunc  7 років тому +1

      Yeah, if you read the PR you'll see I added a RWMutex to DB :)

  • @MrSnack111
    @MrSnack111 7 років тому +5

    Predictably helpful :-) Thank you, Francesc!

  • @ProCoder2007
    @ProCoder2007 6 років тому

    I think I need to rewatch this video several times to get the whole refactoring process :) nice!

  • @kousheralam
    @kousheralam Рік тому

    Enjoyed the episdoe !

  • @deeeeeds
    @deeeeeds 6 років тому +10

    23:03 - Am I'm not going to document it because that's not my problem. 😂

  • @brendanmunro2298
    @brendanmunro2298 7 років тому +2

    The speed up music was perfect!

    • @JustForFunc
      @JustForFunc  7 років тому +4

      Baroque music for baroque tasks 😁

  • @ankitagarwal655
    @ankitagarwal655 7 років тому +11

    You are just awesome :-)

  • @pjox
    @pjox 7 років тому +2

    You improved the audio quality a lot! :)

  • @AlfredZhong
    @AlfredZhong 7 років тому

    Well done. I like your code reviewing videos.

  • @sau007z
    @sau007z 7 років тому +10

    Hi Campoy!
    Wouldn't make more sense instead of type embedding Storage in Service, create a GetSetDeleter, embed it in Storage and then use the Service as a GetSetDeleter? I have two points regarding this:
    1. Len() is being embedded in Service but it's not used by it.
    2. Sounds odd to me thinking a service as a "Storage", since this it just what it says it is, a service. Using GetSetDeleter would make more sense in my head.
    Just let me know what you think about it.
    Cheers!

    • @covain6964
      @covain6964 5 років тому +1

      Yeah, also you have to keep in mind difference between service.Set() and service.Storage.Set() all the way you are coding. It's confusing.

    • @rinosukmandityo6448
      @rinosukmandityo6448 3 роки тому

      Yeah that's exactly my doubt too.
      If we have to add more methods to Storage signature to handle different Service that means we have more useless methods in current Service.

  • @rafael84
    @rafael84 7 років тому

    Very good, as expected. Thanks!

  • @alexalex6643
    @alexalex6643 2 роки тому

    you are supergeil) Thank for video

  • @imavalverde
    @imavalverde 6 років тому

    Really great Francesc, thank you. I am just wondering if you use some kind of ioc container to do the dependecy injection. If you do can you show us?

  • @yeqowcc1053
    @yeqowcc1053 6 років тому

    Love the JustForFunc, by the way, I'm waiting for the part 2 of CSVQL

  • @danielgil3131
    @danielgil3131 7 років тому

    Great video as always

  • @patomackcodes4093
    @patomackcodes4093 7 років тому

    Great video, Thank you Francesc!

  • @AbdulfatahMohammedSheikhMohamm
    @AbdulfatahMohammedSheikhMohamm 5 місяців тому

    Like you review

  • @BLATSHIT
    @BLATSHIT 4 роки тому +1

    We need more of this! Why did he stop?

    • @zsoltbr
      @zsoltbr 4 роки тому +1

      I guess Apple has a different attitude towards this. Even if they'd allow him to continue to teach us for free, that best must happen on iTunes, not here, in Google-land... 🙄

  • @evarlast
    @evarlast 7 років тому

    @ 19:26 the bytes.Buffer cannot be used because it is not a seeker, but bytes.Reader is. Why not use bytes.Reader?

  • @MatteoSuppo
    @MatteoSuppo 7 років тому +1

    How do you navigate code written with interfaces? Vscode isn't much helpful since it jumps to the interface definition while you probably want to jump into the implementation.

    • @wWvwvV
      @wWvwvV 7 років тому

      Seems to be a shortcoming of vscode-go. Normally Shift+F12 shows all occurrences - uses and implementations.
      But when there is an interface in the way you're not able to find implementations from a use (and vice versa).

  • @Julienovich
    @Julienovich 7 років тому

    I lost the episode telling about VScode. Can't find it. Anyone can post a link?

  • @bashmohandes
    @bashmohandes 6 років тому

    Now you can use Uber's dig package to glue things together in main 👍🏼

  • @bahdjibrildjibril
    @bahdjibrildjibril 7 років тому

    Awesome video

  • @nicolasparada
    @nicolasparada 7 років тому

    Nice~

  • @notangryjustdismayed
    @notangryjustdismayed 7 років тому

    "The names are not great, but whatever"
    No. Not "whatever"!

    • @JustForFunc
      @JustForFunc  7 років тому +2

      The video would be an hour long if I reviewed everything.
      Whatever, in this context, means I won't get in the details but read the PR linked in the description for all the gory details

  • @AbdulfatahMohammedSheikhMohamm
    @AbdulfatahMohammedSheikhMohamm 5 місяців тому

    Like you review