Advanced Golang: Channels, Context and Interfaces Explained

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 Жыл бұрын

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

  • @robimalco
    @robimalco2 жыл бұрын

    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 жыл бұрын

    waiting eagerly for more

  • @shmeleff_ural

    @shmeleff_ural

    Жыл бұрын

    Agreed

  • @gregsullivan7408

    @gregsullivan7408

    6 ай бұрын

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

  • @typ0_cratz
    @typ0_cratz Жыл бұрын

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

  • @thor_

    @thor_

    6 ай бұрын

    The best way of working!

  • @David-xy4nw
    @David-xy4nw Жыл бұрын

    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_erimez2 жыл бұрын

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

  • @jamestk656
    @jamestk6562 ай бұрын

    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
    @exxzxxe9 ай бұрын

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

  • @erichshan7964
    @erichshan79649 ай бұрын

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

  • @vanjastojanovic5023
    @vanjastojanovic50232 ай бұрын

    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
    @ngjimmy2 жыл бұрын

    I love your isolation method of explaining code

  • @senthilramalingam9500
    @senthilramalingam95002 жыл бұрын

    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.

  • @johnnychang3456
    @johnnychang34562 жыл бұрын

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

  • @jondoe79
    @jondoe79 Жыл бұрын

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

  • @amesasw
    @amesasw7 ай бұрын

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

  • @MelodyLu9000
    @MelodyLu900010 ай бұрын

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

  • @VadimCebotari
    @VadimCebotari6 ай бұрын

    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
    @visa22562 жыл бұрын

    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
    @rshraddha2 жыл бұрын

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

  • @pp09997444828
    @pp099974448289 ай бұрын

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

  • @taqitahmid50
    @taqitahmid5011 ай бұрын

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

  • @nwxxzchen3105
    @nwxxzchen31052 жыл бұрын

    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 Жыл бұрын

    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
    @WaldirBorbaJunior2 жыл бұрын

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

  • @DJStompZone
    @DJStompZone9 ай бұрын

    My guy really recorded a whole KZread 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 🤣

  • @nodidog
    @nodidog Жыл бұрын

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

  • @samiurias
    @samiurias2 жыл бұрын

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

  • @method_actor
    @method_actor2 жыл бұрын

    You're doing a great job! Love your channel

  • @SanaagSomaliland
    @SanaagSomaliland Жыл бұрын

    You explained these very well. Thanks.

  • @BoukeGroenescheij
    @BoukeGroenescheij2 жыл бұрын

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

  • @thenomadchronicles
    @thenomadchronicles10 ай бұрын

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

  • @davida.7586
    @davida.75868 ай бұрын

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

  • @ianlogan3055
    @ianlogan30555 ай бұрын

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

  • @gusjoagomez
    @gusjoagomez2 жыл бұрын

    Nice video Ryan!!! Thanks from Argentina!

  • @speedTurtle
    @speedTurtle9 ай бұрын

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

  • @marnesh2008
    @marnesh20082 жыл бұрын

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

  • @f00b4r123
    @f00b4r123 Жыл бұрын

    Excellent explanation. Thanks!

  • @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❤

  • @user-lv9ts6mx7y
    @user-lv9ts6mx7y9 ай бұрын

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

  • @pranayr1718
    @pranayr17182 жыл бұрын

    Ryan , the way you explain is cool! Thank you

  • @vlad_covers
    @vlad_covers Жыл бұрын

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

  • @linamoussadek6467
    @linamoussadek6467 Жыл бұрын

    BEST VIDEO !! Deserves so many more likes omgg

  • @ireenisabel988
    @ireenisabel9882 жыл бұрын

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

  • @stevemurphy5709
    @stevemurphy5709 Жыл бұрын

    Ryan, this is an amazing tutorial. Thanks!

  • @losiu998
    @losiu9982 жыл бұрын

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

  • @EpicMicky300
    @EpicMicky300 Жыл бұрын

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

  • @anamikavarshney28
    @anamikavarshney282 жыл бұрын

    very clear and precise explaination!

  • @justellvonk2518
    @justellvonk2518 Жыл бұрын

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

  • @shivangitomar5557
    @shivangitomar55572 жыл бұрын

    You are amazing! Love the way you teach

  • @rban123
    @rban1232 жыл бұрын

    Crimininally underrated channel

  • @gelbander
    @gelbander Жыл бұрын

    Great work on this! 🔥

  • @elgs1980
    @elgs1980 Жыл бұрын

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

  • @youtubevanged9359
    @youtubevanged93593 ай бұрын

    Brilliant explanation. Thanks man

  • @varpen
    @varpen Жыл бұрын

    What a great video! Thank you.

  • @tharouetmaamouri9831
    @tharouetmaamouri98316 ай бұрын

    Like smooth Jazz ! Great explanation ...

  • @reanimatedmanx
    @reanimatedmanx Жыл бұрын

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

  • @ashiqdey
    @ashiqdey Жыл бұрын

    awesome video man, so clear and crisp

  • @s-guytech9160
    @s-guytech9160 Жыл бұрын

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

  • @winsonwardana28
    @winsonwardana2811 ай бұрын

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

  • @hectorrios1432
    @hectorrios14322 жыл бұрын

    Really great explanation. Thank you.

  • @prinkagupta3309
    @prinkagupta33092 ай бұрын

    Thanks Ryan :) you are a good teacher

  • @nassehk
    @nassehk2 жыл бұрын

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

  • @alexander3293
    @alexander32932 жыл бұрын

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

  • @jorgesilva932
    @jorgesilva932 Жыл бұрын

    Great explanation, thank you !

  • @MrTyty527
    @MrTyty527 Жыл бұрын

    Giving tutorials without leaving bed haha, good one!

  • @solar2361
    @solar23612 жыл бұрын

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

  • @nsgirish
    @nsgirish2 жыл бұрын

    Excellently explained. Thanks sir

  • @aaaalord
    @aaaalord2 жыл бұрын

    thank you for this great and simple and understandable tutorial

  • @Simas1234
    @Simas1234 Жыл бұрын

    This was helpful, thanks Ryan

  • @politeboy2996
    @politeboy2996 Жыл бұрын

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

  • @Peggysue_zSut
    @Peggysue_zSut2 жыл бұрын

    What an amazing teaching. :)

  • @mehdiboujid8761
    @mehdiboujid87612 жыл бұрын

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

  • @OmarAbdelaziz__47
    @OmarAbdelaziz__472 жыл бұрын

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

  • @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
    @johnr39365 ай бұрын

    Awesome explanations.

  • @sondosabd9474
    @sondosabd9474 Жыл бұрын

    Thank you very much for this tutorial

  • @nicknick65
    @nicknick652 жыл бұрын

    laid back and perfect, just subscribed

  • @arthurmastropietro5261
    @arthurmastropietro52619 ай бұрын

    Great job, love it!

  • @pss_crs
    @pss_crs2 жыл бұрын

    Why KZread 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

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars2 жыл бұрын

    simple and sweet, thanks :)

  • @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

  • @namename8986
    @namename8986 Жыл бұрын

    honestly best tutorial in golang. make more stuff plz

  • @isurukdniss
    @isurukdniss2 жыл бұрын

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

  • @numbr6
    @numbr62 жыл бұрын

    Nice. Thanks for sharing your knowledge.

  • @AhmedAli-go7wx
    @AhmedAli-go7wx Жыл бұрын

    Great explanation ,,,thanks

  • @gustavodeloloalmeida
    @gustavodeloloalmeida2 жыл бұрын

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

  • @saurontrollbrawl
    @saurontrollbrawl Жыл бұрын

    Subscribed, this is amazing

  • @lylerodericks
    @lylerodericks Жыл бұрын

    Very very helpful!

  • @kasoivasoy7808
    @kasoivasoy7808 Жыл бұрын

    Thanks, Morgan!

  • @steveheslouin3174
    @steveheslouin3174 Жыл бұрын

    love your style 😄

  • @rahulgarai4822
    @rahulgarai482211 ай бұрын

    Nice explanation 👍. liked it...

  • @someone5781
    @someone57812 жыл бұрын

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

  • @A.A.
    @A.A.2 жыл бұрын

    that was super cool explanation