Advanced Golang: Channels, Context and Interfaces Explained

Поделиться
HTML-код
  • Опубликовано: 10 июн 2024
  • Today, I'll provide a simple breakdown of channels, context and interfaces in Golang. I'll show examples of why they are useful and how to properly use them in the real world.
    0:00 Intro
    0:17 Channels
    8:35 Context
    13:55 Interfaces
    21:53 Conclusion
    Channels are a safe way of transferring data between goroutines without using a mutex. You can send data to a channel in one goroutine, then consume data from the same channel in another goroutine. By default, a channel does not have space to store data, so you must simultaneously send and receive data from the channel to avoid a deadlock. A buffered channel allows you to allocate space to temporarily store data in the channel.
    Context is an object that can be safely passed to multiple goroutines to provide a way to implement a timeout or cancellation to a function. 3rd party libraries that make HTTP requests or database requests typically have support for providing your own context so you cancel those operations.
    Interfaces are a great way to enforce a blueprint for what your app can do, similar to object oriented programming. For example, there are many different types of bank accounts, but you can use a single interface to interact with all of them: GetBalance(), Deposit() and Withdraw(). This makes your high-level code easier to work with because the implementation is abstracted away.

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

  • @whyyuou7629
    @whyyuou7629 Год назад +73

    this guy just chilling on his bed while explaining complex staff, loving it haha

  • @robimalco
    @robimalco 2 года назад +213

    Ryan you probably are already aware of it, but you have such a talent in explaining stuff. Thanks for your work. Keep exploring Golang please

    • @TechEats
      @TechEats 2 года назад +2

      waiting eagerly for more

    • @shmeleff_ural
      @shmeleff_ural Год назад +1

      Agreed

    • @gregsullivan7408
      @gregsullivan7408 6 месяцев назад +1

      It also helps that he speaks fluent English, with a great voice

  • @typ0_cratz
    @typ0_cratz Год назад +14

    Love it, talking about advanced software concepts while chilling on his bed. Legend 👏

    • @thor_
      @thor_ 6 месяцев назад +1

      The best way of working!

  • @David-xy4nw
    @David-xy4nw Год назад +38

    This video is a gem, It would have been awesome if you could have a series for advanced golang. I am sure other viewers would want that too !

  • @esra_erimez
    @esra_erimez 2 года назад +5

    Your voice is ASMR but the best part is you know what you're talking about and how to explain it.

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

    I've read several books on Go but your explanations have been clearer and more concise to me. I especially like your description of (unbuffered) channels as being portals that don't store anything and why they could result in a deadlock. I never really understood that from my readings until you explained it.

  • @exxzxxe
    @exxzxxe 9 месяцев назад +5

    Ryan- you have a natural ability for simply explaining complex topics. Good job!

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

    your casual style makes information so much more accessible. i subbed!

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

    Amazing video series for go, I love hearing advanced topics in a new language, that I can carry over from previous ones I know.🎉❤

  • @ngjimmy
    @ngjimmy 2 года назад +6

    I love your isolation method of explaining code

  • @senthilramalingam9500
    @senthilramalingam9500 2 года назад +4

    Dude, your explanation is crystal clear, very specifics and more importantly no blabbering. You should put more tutorials or create a course in udemy man...

  • @salvaje1
    @salvaje1 Год назад

    Damn, I like how this guy explains things. He oozes experience just from how he talks, and doesn't look like he's reading from an off screen document. Like he was working on some go code and thought it would be nice to share it in a video. He also doesn't just regurgitate what is in the docs like others.

  • @jondoe79
    @jondoe79 Год назад +5

    We need more of golang, your content is superb and easy to understand, very practical examples.

  • @johnnychang3456
    @johnnychang3456 2 года назад +23

    Hey Ryan this is great quality content! Please do more Go videos as there’s not much on RUclips. Keep up with the good work!

  • @amesasw
    @amesasw 7 месяцев назад +1

    Man, excellent video. Nice to see someone put together solid examples and walk through them well.

  • @MelodyLu9000
    @MelodyLu9000 10 месяцев назад

    Your explanations and demos here are the best! Really helped me get the concept. Thank you so much for making this video!

  • @VadimCebotari
    @VadimCebotari 6 месяцев назад

    Love how you explain the concepts. Keeping them simply and clear.
    Thanks a lot for the great work

  • @ramgopal2520
    @ramgopal2520 Год назад

    I have gone through the basics of Golang. I had trouble understanding interfaces and channels. You have explained it very well. Thank you a lot!!! The way you compared unbuffered channel to a portal was epic.. I wish everyone explains concept like you.

  • @bruceleeharrison9284
    @bruceleeharrison9284 Год назад

    I hadn't touched Go in a couple years, and this video was a perfect refresher to jog my memory on the operation of channels. Nice job!

  • @blueice1364
    @blueice1364 Год назад

    You are a great teacher. No one out there explained Go in such simple yet elegant way. Thank you!

  • @visa2256
    @visa2256 2 года назад +3

    Thank you Ryan, I love the way of your teaching, its pace is very smooth and gentle, not only you deliver the explanation clearly, but also make it easier for us to digest.

  • @rshraddha
    @rshraddha 2 года назад +3

    Great tutorial Ryan. Finally I can actually understand contexts in Go.

  • @pp09997444828
    @pp09997444828 8 месяцев назад

    couldn't understand it better .. you are champ.. thanks Ryan :)

  • @taqitahmid50
    @taqitahmid50 11 месяцев назад

    Your voice is almost ASMR level! Also, great explanations.

  • @nwxxzchen3105
    @nwxxzchen3105 2 года назад +6

    I should must give this content a thumbs up, channel, context, interface you give us the most clear explanation in the whole universe.

  • @vl.v
    @vl.v Год назад +2

    Lovely explanations, I'd love to see more of you, very well spoken and presented!

  • @stevekamga5977
    @stevekamga5977 Год назад

    Hey Ryan, you have a talent. Thank you for your videos

  • @akmzahidulislam2764
    @akmzahidulislam2764 Год назад

    Brilliant work, Ryan. Deeply impressed

  • @WaldirBorbaJunior
    @WaldirBorbaJunior 2 года назад +1

    Man... what explanation. Sincerely the best one.

  • @nodidog
    @nodidog Год назад

    Just wanted to say thanks for making this, it's a great explanation - very helpful

  • @DJStompZone
    @DJStompZone 9 месяцев назад

    My guy really recorded a whole RUclips video from bed, that's gotta take a lot of moxie. Every other video on this channel I've watched has been super clean and professional though, so I'll allow it... This time
    🤣

  • @samiurias
    @samiurias 2 года назад +2

    Incredibly good explanation! :D
    Thank you very much! 😊

  • @SanaagSomaliland
    @SanaagSomaliland Год назад

    You explained these very well. Thanks.

  • @method_actor
    @method_actor 2 года назад +2

    You're doing a great job! Love your channel

  • @BoukeGroenescheij
    @BoukeGroenescheij 2 года назад

    Great tutorial - very clear now to me! Thanks!!!

  • @thenomadchronicles
    @thenomadchronicles 10 месяцев назад

    This was the best video that I watched that makes me really understand Interfaces. Thank you so much!

  • @davida.7586
    @davida.7586 8 месяцев назад

    Perfect Explanation!!!
    Thank you so much !!!

  • @ianlogan3055
    @ianlogan3055 5 месяцев назад

    I really like the way you explained channels, nicely done!

  • @gusjoagomez
    @gusjoagomez 2 года назад

    Nice video Ryan!!! Thanks from Argentina!

  • @speedTurtle
    @speedTurtle 9 месяцев назад

    Well done. I've seen the context and interface concepts explained before but this video made the ideas click.

  • @sandakelum_priyamantha
    @sandakelum_priyamantha Год назад

    Your tutorial is very easy for me to understand, even though I barely understand English, I understand it well when you explain it with examples. I wish you to do more things like this. Thank you very much❤

  • @f00b4r123
    @f00b4r123 Год назад

    Excellent explanation. Thanks!

  • @marnesh2008
    @marnesh2008 2 года назад +1

    you should become a golang trainer or teacher, this is the best explanation video so far

  • @vlad_covers
    @vlad_covers Год назад

    The explanation and the style of the video is really awesome! Subscribed.

  • @pranayr1718
    @pranayr1718 2 года назад

    Ryan , the way you explain is cool! Thank you

  • @user-lv9ts6mx7y
    @user-lv9ts6mx7y 9 месяцев назад

    Great video. Complex topics, simplified, and practical use cases. Thanks for this one. Now off to find help on some projects.

  • @ireenisabel988
    @ireenisabel988 2 года назад

    Man, you have a voice of morgan freeman and a potential to be a great teacher like Feynman.

  • @linamoussadek6467
    @linamoussadek6467 Год назад

    BEST VIDEO !! Deserves so many more likes omgg

  • @stevemurphy5709
    @stevemurphy5709 Год назад

    Ryan, this is an amazing tutorial. Thanks!

  • @losiu998
    @losiu998 2 года назад +1

    Damn, I watched just one your video and I love the way you explain things. You have radio voice too. Keep doing it!

  • @anamikavarshney28
    @anamikavarshney28 2 года назад

    very clear and precise explaination!

  • @EpicMicky300
    @EpicMicky300 Год назад

    this dude's the golang goat! best tutorials from a bed, confirmed.

  • @shivangitomar5557
    @shivangitomar5557 2 года назад +1

    You are amazing! Love the way you teach

  • @justellvonk2518
    @justellvonk2518 Год назад

    Thank you so much for your videos! Your explanations are so great! :)

  • @rban123
    @rban123 2 года назад +1

    Crimininally underrated channel

  • @gelbander
    @gelbander Год назад

    Great work on this! 🔥

  • @youtubevanged9359
    @youtubevanged9359 3 месяца назад

    Brilliant explanation. Thanks man

  • @elgs1980
    @elgs1980 Год назад

    Ryan you are the best. Please don't stop making new videos.

  • @varpen
    @varpen Год назад

    What a great video! Thank you.

  • @reanimatedmanx
    @reanimatedmanx Год назад

    I'm going to repeat other commenters, great voice and explanation, very pleasant to listen. GL on the channel! Subscribed

  • @tharouetmaamouri9831
    @tharouetmaamouri9831 6 месяцев назад

    Like smooth Jazz ! Great explanation ...

  • @ashiqdey
    @ashiqdey Год назад

    awesome video man, so clear and crisp

  • @winsonwardana28
    @winsonwardana28 11 месяцев назад

    Thank you for choosing words that can be understand by human 👍👍

  • @hectorrios1432
    @hectorrios1432 2 года назад

    Really great explanation. Thank you.

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

    Thanks Ryan :) you are a good teacher

  • @s-guytech9160
    @s-guytech9160 Год назад

    I mistakenly un liked because I did not know I already liked it before. Cool stuff, Great Explanation.

  • @alexander3293
    @alexander3293 2 года назад +1

    just found your channel. really, really nice content, hope you get more attention!

  • @nassehk
    @nassehk Год назад

    Man I am gonna use this video in my meditation! It is so relaxing dude...

  • @jorgesilva932
    @jorgesilva932 Год назад

    Great explanation, thank you !

  • @MrTyty527
    @MrTyty527 Год назад

    Giving tutorials without leaving bed haha, good one!

  • @nsgirish
    @nsgirish 2 года назад

    Excellently explained. Thanks sir

  • @solar2361
    @solar2361 2 года назад +1

    Love it. While you are teaching from your bed. I also watching from mine.

  • @Simas1234
    @Simas1234 Год назад

    This was helpful, thanks Ryan

  • @aaaalord
    @aaaalord 2 года назад

    thank you for this great and simple and understandable tutorial

  • @politeboy2996
    @politeboy2996 Год назад

    God bless you, brother.
    If possible continue this type of content.

  • @Peggysue_zSut
    @Peggysue_zSut 2 года назад +1

    What an amazing teaching. :)

  • @OmarAbdelaziz__47
    @OmarAbdelaziz__47 2 года назад +1

    Very informative, Please keep doing more about golang topics, your explanation is quality.

  • @mehdiboujid8761
    @mehdiboujid8761 2 года назад

    i really was waiting for something like this specially from you thank you very much keep it up !

  • @user-ey6zi9jt5s
    @user-ey6zi9jt5s Год назад

    Ryan is the Laurence Fishburne (of "The Matrix" fame) of Coding. So smooth, assured and comfortable with the subject matter! Completely agree that training orgs like ACouldGuru, OReily etc could utilise his unique skillset and approach!

  • @johnr3936
    @johnr3936 4 месяца назад

    Awesome explanations.

  • @sondosabd9474
    @sondosabd9474 Год назад

    Thank you very much for this tutorial

  • @nicknick65
    @nicknick65 2 года назад

    laid back and perfect, just subscribed

  • @arthurmastropietro5261
    @arthurmastropietro5261 9 месяцев назад

    Great job, love it!

  • @pss_crs
    @pss_crs 2 года назад

    Why RUclips algorithm Doesn't support channels like Ryan instead of Music or fake pranks.
    I was very impressed with the way you convey knowledge. If you do courses for sale, I will be the first to buy them

  • @MobileWTF
    @MobileWTF Год назад

    You're meant to teach man, great job! Thank you

  • @kapo5636
    @kapo5636 Год назад

    You should do a lot more of coding from your bed setup. It is very relaxing to learn from you! I definitely learned a lot

  • @goldenboy_808
    @goldenboy_808 Год назад

    This was a really good tutorial hope you do more

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 2 года назад +1

    simple and sweet, thanks :)

  • @namename8986
    @namename8986 Год назад

    honestly best tutorial in golang. make more stuff plz

  • @isurukdniss
    @isurukdniss 2 года назад

    Wow! what an explanation. Please make more videos on Golang

  • @numbr6
    @numbr6 2 года назад

    Nice. Thanks for sharing your knowledge.

  • @AhmedAli-go7wx
    @AhmedAli-go7wx Год назад

    Great explanation ,,,thanks

  • @gustavodeloloalmeida
    @gustavodeloloalmeida 2 года назад

    the best explanation i have ever seen (i saw maybe 20 videos kkk). You earn more one follow. Excelent Job !!!!

  • @lylerodericks
    @lylerodericks Год назад

    Very very helpful!

  • @saurontrollbrawl
    @saurontrollbrawl Год назад

    Subscribed, this is amazing

  • @kasoivasoy7808
    @kasoivasoy7808 11 месяцев назад

    Thanks, Morgan!

  • @steveheslouin3174
    @steveheslouin3174 Год назад

    love your style 😄

  • @someone5781
    @someone5781 2 года назад +1

    This is a great explanation Ryan! Would you consider making a full golang tutorial? :)

  • @rahulgarai4822
    @rahulgarai4822 11 месяцев назад

    Nice explanation 👍. liked it...

  • @A.A.
    @A.A. 2 года назад

    that was super cool explanation