SOLID in Go in 8 minutes (5m Friday #5)

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

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

  • @ER1FM
    @ER1FM 4 ปีที่แล้ว +12

    Thanks, I had my doubts about Go you sold me on the last MDC :) Keep up the videos, good stuff

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว +1

      Thanks Ilia, yeah last time was rough. The organizers were pretty crappy and they also castrated me on timing, because I was the last speaker on the list. Maybe next time I'll do it better

    • @ER1FM
      @ER1FM 4 ปีที่แล้ว

      @@SteveHook Yeah, a pity. It was really interesting, I got furious because of them. That was rude.

  • @qwerty86567
    @qwerty86567 3 ปีที่แล้ว

    One of the best explanations of SOLID I've seen. Concise but complete. Kudos for speaking quickly; no need to watch your vids at 2X speed!

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Thanks mate, should come up with some bigger examples

  • @RyoCodes
    @RyoCodes ปีที่แล้ว

    Voila that is the most impressive video tutorial about solid in golang😁😜

    • @SteveHook
      @SteveHook  ปีที่แล้ว

      Thanks a lot buddy 🥰🥰 I guess an update is required 😋

  • @alexboulange2317
    @alexboulange2317 3 ปีที่แล้ว +1

    So clear, so concise, better can't be : you're the king !

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      😄😄 I’m trying

  • @yacce4463
    @yacce4463 2 ปีที่แล้ว +1

    I have been doing all this without knowing about the SOLID acronym. Nice video btw.

  • @codesurge6838
    @codesurge6838 2 ปีที่แล้ว +3

    Great explanation in short clips. You clarified the concept in very simple and straight forward examples. Thanks pal, senpai rather!

    • @SteveHook
      @SteveHook  2 ปีที่แล้ว

      Thank you so much Lance, glad you enjoyed this 💪

  • @akmon71
    @akmon71 3 ปีที่แล้ว +7

    Hey man. Thanks for the effort of making attempt on SOLID in GO. Anyway, you did some mistakes:
    With the Single Responsibility Principle, you correctly split the responsibility of computing and printing, but right away you broke it - Outputting is one responsibility, formatting is yet another one. Not to mention that your Ouputter has two methods: Text and JSON which breaks the Single Responsibility Principle again. Why this is bad? Because you can have multiple output targets: console, file, some device, and multiple formats: YAML, JSON, text, and then to get the desired combination you'll need to create 3x3 methods. When doing solid you should go with 6 simple structs that can be combined in any way you need. Some might say - "why so many structs?", but when you need to pass it to another method/function you will pass only two interfaces. This will help avoid switches and ifs control statements inside of the method/function body to figure out which method you should call. This code will be super easy for unit testing and maintenance.
    With the Open-Closed Principle, you forgot to mention struct encapsulation. No other implementation should be closed on public properties values since they might change. The problem here is that some classes could write to public property, making the internal state of this object inconsistent, which will affect the behavior in an undesired way.
    With the Interface Segregation Principle, your "object" interface breaks this principle - it should have only the "volume" method signature. You probably did this mistake, by creating a not logical method "areaVolumeSum" - what it should model in the real world? When you would have "areaSum" and "volumeSum" functions you'd probably make a proper split of interfaces. This is also the reason that interfaces should be created first - to not be biased by already created usage. If you have a sphere struct and you need it only for volumeSum, why also implementing the area method which you don't need?
    The Dependency Inversion example is good, but the example required to be fixed is not full. To make it full you'd need to implement "NewUserRepository" function where a new instance of MySQL DB is created. An example of fixing it would require this function to take the interface of DB as an argument and set it as a value of a new object of this struct.
    PS. I want to congratulate you on your presentation skills. They're top-notch.

    • @sigmawolf228
      @sigmawolf228 2 ปีที่แล้ว

      solid is just kilometers of unesseary abstractions

    • @Rundik
      @Rundik 2 ปีที่แล้ว +1

      @@sigmawolf228 which can save a lot of time especially for the new comers working on a large project

  • @antonyinjila7152
    @antonyinjila7152 ปีที่แล้ว

    Wow, for a long time SOLID did not make sense to me. Today it has made total sense. Moving forward I will make use of all these principles. GOOD JOB. ALWAYS.

    • @SteveHook
      @SteveHook  ปีที่แล้ว

      Thanks a lot buddy, hope it helped 🤗

  • @ravikanthgarimella2355
    @ravikanthgarimella2355 ปีที่แล้ว

    great work on this Steve, looking for more videos

    • @SteveHook
      @SteveHook  ปีที่แล้ว

      Thanks a lot sir 🥰🥰

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

    Thank goodness. I get how to apply the principles.

  • @azbrestjohn110
    @azbrestjohn110 3 ปีที่แล้ว

    Bravo !!! I thought for one second as a newbie that golang would be limited for conception, but boy I'm so glad that I was wrong !

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Yeah, still my favorite language ❤️❤️

  • @palashgupta5355
    @palashgupta5355 3 ปีที่แล้ว +2

    Great explanation bro...
    We can use these principles to make clean architecture like in rest API we can eliminate the dependency on the router we use, it can be chi, mux, or anything. Likewise, a database can be MongoDB, Postgre or InMemoryDB.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว +1

      Thx mate, yeah. I guess this principle needs an updated video

  • @Pellefaanten
    @Pellefaanten 4 ปีที่แล้ว +6

    Very nice video! It would be nice to see you implement these principles in a more complex example. Maybe a tutorial on building a go rest api using solid principles!

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว +5

      💯 agree man, that video series it’s coming up. So many plans, and so much work. Stay tuned, I’ll keep ya posted

    • @Er0Shara
      @Er0Shara 3 ปีที่แล้ว +1

      @@SteveHook Hey Man, Great work, Just wanted to follow up on this thread, any plans for the REST API videos , where we can see the extensive use of these principals in action, I know, a lot will come when we would apply these in real projects, but still would love to follow if you have something in pipeline as mentioned above.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว +1

      Sure man. Planning to roll out some of them soon

    • @Er0Shara
      @Er0Shara 3 ปีที่แล้ว

      @@SteveHook thanks, have clicked on thr bell icon! Btw, to add there is code-gen swagger which generates the sever stub , a lot is taken care by simple swagger generation, but i guess it might be complex for other to understand, simple mux or gin framework would work, more focus is on understanding the SOLID in action, i am new to design principles and trying to find some better resources. I can write code but i want to write better easy to read and maintainable code.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว +1

      Stay tuned my friend 😉

  • @martinsouto8818
    @martinsouto8818 4 ปีที่แล้ว +2

    Man you keep improving! you have earned the sub! =)

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว

      Thanks man. Guess what there’s room for more improvement

  • @pravinbudage1830
    @pravinbudage1830 2 ปีที่แล้ว

    Simply Superb

    • @SteveHook
      @SteveHook  2 ปีที่แล้ว

      Thanks a lot 🥰

  • @Zizo8182
    @Zizo8182 3 ปีที่แล้ว

    Great one.

  • @danatbekzhassarov5078
    @danatbekzhassarov5078 3 ปีที่แล้ว +2

    Absolutely amazing explanation! Simple, clear and on point! Thanks man! subscribed:)

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว +1

      Thanks mate, glad to hear that 😊😊

  • @shofyansky
    @shofyansky 3 ปีที่แล้ว

    good video. keep make this awesome video. refresh video.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Thanks, will definitely do

  • @yogeshdharya3857
    @yogeshdharya3857 ปีที่แล้ว

    Enjoyed ur content a lot . Was understandable and quite amusing at the same time 😁👍

  • @shital135
    @shital135 3 ปีที่แล้ว

    Great explanation! After watching your videos, I have started to watch other videos at a fast speed. :)

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Gotta admit though I kinda was rushing back them in those videos 😂😂😅

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

    just amazing !!! but background music made it go faster....(sometime it feels like concept will go away with background music & i will not be able to grasp it😅).

  • @saulramirez727
    @saulramirez727 3 ปีที่แล้ว

    Amazing

  • @zhian1354
    @zhian1354 2 ปีที่แล้ว

    Great explanation

    • @SteveHook
      @SteveHook  2 ปีที่แล้ว

      Thx mate ☺️

    • @SteveHook
      @SteveHook  2 ปีที่แล้ว

      Thx mate ☺️

  • @SaeedNeamati
    @SaeedNeamati 3 ปีที่แล้ว

    very good and informative. excellent examples.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Thanks mate, glad u’re enjoying it 😊😊

  • @henriquealexandreh
    @henriquealexandreh 3 ปีที่แล้ว

    Awesome explanation! Thanks, Steve.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Thanks mate, hopefully I come with an updated version or smth ☺️

  • @sajanjaiswal8582
    @sajanjaiswal8582 3 ปีที่แล้ว

    Thanks!

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      You’re welcome ☺️

  • @assylkhanyeszhanov2356
    @assylkhanyeszhanov2356 3 ปีที่แล้ว

    That one was really good! Thank you for sharing)

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      You’re welcome 😎

  • @FunCubing3x3
    @FunCubing3x3 4 ปีที่แล้ว

    Brilliant presentation. Had to subscribe. Peace!

  • @denys3211
    @denys3211 3 ปีที่แล้ว

    bruh only 3k suscribers, why? Where have you been all this time? Suscribed!

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Thanks man, idk. Guess I need to put in more work

  • @qianbang_
    @qianbang_ 3 ปีที่แล้ว

    Nice simple clear explanation.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Thanks mate, glad it was useful

  • @enriquellerena4779
    @enriquellerena4779 4 ปีที่แล้ว

    Man I”m kearning so much from your vids! Sub

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว

      Thanks, glad you are enjoying them

  • @shleebeez
    @shleebeez 4 ปีที่แล้ว

    glad i searched "go solid principles." perhaps you could make some videos on go antipatterns, io writer and reader, other common/interesting parts of the standard library, when to implement an interface (like if you only have 1 type that implements your interface you probably don't need an interface. and the more methods an interface has, the less likely it is that there will be multiple types implementing it) , anything you personally found challenging related to go. just some ideas i think would be helpful as a go developer and trying to become more intermediate as opposed to beginner

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว

      I should definitely do. I received more requests about SOLID in more details and should come up with a schedule so they make it in my videos. Glad you found the channel 🥳

    • @shleebeez
      @shleebeez 4 ปีที่แล้ว

      @@SteveHook that would be great! reviewing the open/closed principle, i thought OH MY we, including our senior engineers, do not implement that very often...

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว +1

      It happens. In a real world things are not always beautiful and according to principles and best practices

  • @vtvvnha2230
    @vtvvnha2230 4 ปีที่แล้ว +1

    could you please make a series videos for making web application in go

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว +1

      vtvvn ha Sure, got that on my list as well

    • @tonylegge7261
      @tonylegge7261 3 ปีที่แล้ว

      Here you go - lets-go.alexedwards.net/

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว +1

      Just FYI guys, I thought of doing a web dev series. Instead I am currently working on a Udemy course that’s gonna be big and comprehensive with lots of surprises and at a high quality as usual. So stay tuned. It’s coming up in couple of months 😊

  • @francis8067
    @francis8067 3 ปีที่แล้ว

    Great video, subscribed!

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Glad you enjoyed it 😊😊

  • @mukulchauhan7824
    @mukulchauhan7824 4 ปีที่แล้ว +1

    Hi bro, great stuff again. 1 question where do you get the sounds from in video editing. Like glass lock cat etc.

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว +1

      Hi man, it’s multiple sources depending which one gives me a better option. I guess I should link them in description.
      So it’s EpidemicSound, Envato Elements and SoundSnap

    • @mukulchauhan7824
      @mukulchauhan7824 4 ปีที่แล้ว

      Steve Hook thanks, found some really good stuff there.

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว

      Yeah, lots of SFX and Music on those platforms. Forget about the royalty free stuff. Pay a subscription and get everything without a worry

  • @johnxisde
    @johnxisde ปีที่แล้ว

    great explanation, but i feel like eminem made a video with coding hahaha

  • @kumarvishalben
    @kumarvishalben 3 ปีที่แล้ว

    That thumbnail 😄👌👌👌

  • @Hp-zo8rs
    @Hp-zo8rs 4 ปีที่แล้ว

    Great bro thanks

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว +1

      Thanks man

  • @7dayful
    @7dayful 2 ปีที่แล้ว

    Hey Steve, thanks a lot for the great video. Learned a lot in a short time. May I ask you what vscode extension you use to get the interfaces show under the structs?

    • @SteveHook
      @SteveHook  2 ปีที่แล้ว +1

      Hey Newsha, I mostly use Goland. Not sure VSCode has such an extension, but let me know if you find such a thing 🙂

    • @7dayful
      @7dayful 2 ปีที่แล้ว

      @@SteveHook right, I don’t know why I assumed you use vscode. Sure, if I find anything similar I’ll let you know. That’s a cool feature to have. Not knowing which struct implements which interface is one area that makes it difficult to work with object oriented design patterns in golang. When I saw you had that feature I was very excited.

    • @SteveHook
      @SteveHook  2 ปีที่แล้ว

      In Go you don’t need to know who implements what. Everyone implements at least interface{}. But it’s a nice way of seeing usages in the code, especially when working in a big project 👊

  • @alexboulange2317
    @alexboulange2317 3 ปีที่แล้ว

    I'm not yet "solid" with solid : isn't it a break of the open/close 2nd principle, in the last principle example ?
    "...
    switch res.(type) {
    case map[string]string:
    ..."

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว +1

      So, I used the type assertion in that specific case to simulate a real MySQL / Postgres driver, they normally return different types, which is why I needed the type assertion. Ideally receiving a specific interface would have solved the problem.
      P.S. next time specify the timestamp from the video. Don't make me go through the pain of watching my own video again 😂

    • @alexboulange2317
      @alexboulange2317 3 ปีที่แล้ว

      @@SteveHook THANKS Steve !
      I'm watching some of your videos several time and it's never painfull for me ;-)

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Kidding, I just happen to be sick of watching me after a whole cumbersome editing session 😂 editing myself isn’t an easy thing

  • @MichaelCharlesAubrey
    @MichaelCharlesAubrey 3 ปีที่แล้ว

    What’s your viscose theme?

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว +1

      I am using Goland with Material Theme + Atom Icons 😉

  • @Patrick-xv3si
    @Patrick-xv3si 3 ปีที่แล้ว

    awesome stuff but slow down dude lol!

  • @ardiansyah6794
    @ardiansyah6794 3 ปีที่แล้ว

    Thanks bruh!

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      You’re welcome mate

  • @tonylegge7261
    @tonylegge7261 4 ปีที่แล้ว +1

    Your take on SRP is not correct - A function should only do one thing but this is not the SRP. Uncle Bob's final version, from his book Clean Architecture is "A module should be responsible to one, and only one, Actor". Good video though...!

    • @christiangda
      @christiangda 3 ปีที่แล้ว

      That is exactly was I was to clarify, SRP (The Single Responsibility Principle) talk About "... each software module has only one, and only one, reason to change." And it is not about what it does as functionality!.
      Fortunately, the implementation is Fine!, but what it is mean? if you are going to modify your module as @Steve Hook mention in the video the same module function has two reasons to change (format the output [1] and calculate the result [2]), so if you want to improve/change some of both, you are broken the SRP.

    • @tonylegge7261
      @tonylegge7261 3 ปีที่แล้ว

      @@christiangda Uncle Bob updated the meaning of the SRP.... Remember we are talking about the module NOT the function. The word cohesive implies the SRP. Cohesion is the force that binds together the code responsible to a single actor - Clean Architecture pp 63 Robert C Martin.

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      I think we should clarify what a module really is. A module in software in general is not tied to or necessarily related to the definition and implementation of the module each language and ecosystem has. It rather refers to a piece of executable code that is meant to be run/called by the main or other parts of the program. Be it a function/method/type/module and others. They are all part of the same SRP definition just at a different scale. And IMHO the module word kinda describes all of them in one word perfectly. Hope that clarifies my examples and explanation

    • @tonylegge7261
      @tonylegge7261 3 ปีที่แล้ว

      Steve Hook We have to be careful on this.... going down too far will result in brittle tests. The idea that a module will be responsible to one actor is a delicate balance!

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      I’ll be glad to perhaps make another video where I dive deeper into each and everyone of them. Otherwise it creates confusion for those who watch

  • @maboulmaaly
    @maboulmaaly 4 ปีที่แล้ว

    👍💪👍

  • @boot-strapper
    @boot-strapper 3 ปีที่แล้ว +1

    Seems like a good way to 10x the amount of code, and make it harder to understand. Flexible, sure. Easy to read? not so much.

  • @EightSixx
    @EightSixx 4 ปีที่แล้ว

    do you have any paid courses?

    • @SteveHook
      @SteveHook  4 ปีที่แล้ว

      Not yet, but hopefully will

  • @HSharpknifeedge
    @HSharpknifeedge 3 ปีที่แล้ว

    Dude, thanks for the video, but why you are talking so fast and with lots of pressure? Isn't it important to explain clearly, instead of talking uncomfortably?

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      I guess I tried to fit in 5 mins, which I never do 😅

    • @HSharpknifeedge
      @HSharpknifeedge 3 ปีที่แล้ว

      @@SteveHook Why? Is anybody or TH-cam forcing you to do it in 5 minutes?

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      Noted for future 😉

    • @HSharpknifeedge
      @HSharpknifeedge 3 ปีที่แล้ว

      @@SteveHook Thanks man! :)

    • @SteveHook
      @SteveHook  3 ปีที่แล้ว

      My bad is my bad. Always learning how to serve my audience the best way 😉

  • @Rundik
    @Rundik 2 ปีที่แล้ว

    What a mess. This language needs some syntactic sugar for sure

    • @MrFancaR
      @MrFancaR ปีที่แล้ว

      no,thanks )