Advanced Golang: Channels, Context and Interfaces Explained

  Рет қаралды 107,654

Code With Ryan

Code With Ryan

Күн бұрын

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
@robimalco 2 жыл бұрын
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
@abeldelapaz2153
@abeldelapaz2153 Жыл бұрын
Love it, talking about advanced software concepts while chilling on his bed. Legend 👏
@thor_
@thor_ 6 ай бұрын
The best way of working!
@esra_erimez
@esra_erimez 2 жыл бұрын
Your voice is ASMR but the best part is you know what you're talking about and how to explain it.
@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 !
@jamestk656
@jamestk656 Ай бұрын
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.
@vanjastojanovic5023
@vanjastojanovic5023 2 ай бұрын
Amazing video series for go, I love hearing advanced topics in a new language, that I can carry over from previous ones I know.🎉❤
@exxzxxe
@exxzxxe 9 ай бұрын
Ryan- you have a natural ability for simply explaining complex topics. Good job!
@ngjimmy
@ngjimmy 2 жыл бұрын
I love your isolation method of explaining code
@DJStompZone
@DJStompZone 9 ай бұрын
My guy really recorded a whole KZbin 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 🤣
@taqitahmid50
@taqitahmid50 10 ай бұрын
Your voice is almost ASMR level! Also, great explanations.
@pp09997444828
@pp09997444828 8 ай бұрын
couldn't understand it better .. you are champ.. thanks Ryan :)
@erichshan7964
@erichshan7964 9 ай бұрын
your casual style makes information so much more accessible. i subbed!
@senthilramalingam9500
@senthilramalingam9500 2 жыл бұрын
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...
@johnnychang3456
@johnnychang3456 2 жыл бұрын
Hey Ryan this is great quality content! Please do more Go videos as there’s not much on KZbin. Keep up with the good work!
@rshraddha
@rshraddha 2 жыл бұрын
Great tutorial Ryan. Finally I can actually understand contexts in Go.
@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.
@stevekamga5977
@stevekamga5977 Жыл бұрын
Hey Ryan, you have a talent. Thank you for your videos
@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!
@ireenisabel988
@ireenisabel988 2 жыл бұрын
Man, you have a voice of morgan freeman and a potential to be a great teacher like Feynman.
@vl.v
@vl.v Жыл бұрын
Lovely explanations, I'd love to see more of you, very well spoken and presented!
@jondoe79
@jondoe79 Жыл бұрын
We need more of golang, your content is superb and easy to understand, very practical examples.
@amesasw
@amesasw 7 ай бұрын
Man, excellent video. Nice to see someone put together solid examples and walk through them well.
@SanaagSomaliland
@SanaagSomaliland Жыл бұрын
You explained these very well. Thanks.
@VadimCebotari
@VadimCebotari 6 ай бұрын
Love how you explain the concepts. Keeping them simply and clear. Thanks a lot for the great work
@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!
@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.
@akmzahidulislam2764
@akmzahidulislam2764 Жыл бұрын
Brilliant work, Ryan. Deeply impressed
@winsonwardana28
@winsonwardana28 11 ай бұрын
Thank you for choosing words that can be understand by human 👍👍
@blueice1364
@blueice1364 Жыл бұрын
You are a great teacher. No one out there explained Go in such simple yet elegant way. Thank you!
@nwxxzchen3105
@nwxxzchen3105 2 жыл бұрын
I should must give this content a thumbs up, channel, context, interface you give us the most clear explanation in the whole universe.
@s-guytech9160
@s-guytech9160 Жыл бұрын
I mistakenly un liked because I did not know I already liked it before. Cool stuff, Great Explanation.
@visa2256
@visa2256 2 жыл бұрын
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.
@marnesh2008
@marnesh2008 2 жыл бұрын
you should become a golang trainer or teacher, this is the best explanation video so far
@samiurias
@samiurias 2 жыл бұрын
Incredibly good explanation! :D Thank you very much! 😊
@WaldirBorbaJunior
@WaldirBorbaJunior 2 жыл бұрын
Man... what explanation. Sincerely the best one.
@ianlogan3055
@ianlogan3055 5 ай бұрын
I really like the way you explained channels, nicely done!
@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.
@davida.7586
@davida.7586 8 ай бұрын
Perfect Explanation!!! Thank you so much !!!
@gusjoagomez
@gusjoagomez 2 жыл бұрын
Nice video Ryan!!! Thanks from Argentina!
@nodidog
@nodidog Жыл бұрын
Just wanted to say thanks for making this, it's a great explanation - very helpful
@speedTurtle
@speedTurtle 8 ай бұрын
Well done. I've seen the context and interface concepts explained before but this video made the ideas click.
@BoukeGroenescheij
@BoukeGroenescheij 2 жыл бұрын
Great tutorial - very clear now to me! Thanks!!!
@vlad_covers
@vlad_covers Жыл бұрын
The explanation and the style of the video is really awesome! Subscribed.
@method_actor
@method_actor 2 жыл бұрын
You're doing a great job! Love your channel
@tharouetmaamouri9831
@tharouetmaamouri9831 5 ай бұрын
Like smooth Jazz ! Great explanation ...
@elgs1980
@elgs1980 Жыл бұрын
Ryan you are the best. Please don't stop making new videos.
@solar2361
@solar2361 2 жыл бұрын
Love it. While you are teaching from your bed. I also watching from mine.
@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!
@f00b4r123
@f00b4r123 Жыл бұрын
Excellent explanation. Thanks!
@politeboy2996
@politeboy2996 Жыл бұрын
God bless you, brother. If possible continue this type of content.
@anamikavarshney28
@anamikavarshney28 2 жыл бұрын
very clear and precise explaination!
@prinkagupta3309
@prinkagupta3309 2 ай бұрын
Thanks Ryan :) you are a good teacher
@pranayr1718
@pranayr1718 2 жыл бұрын
Ryan , the way you explain is cool! Thank you
@youtubevanged9359
@youtubevanged9359 2 ай бұрын
Brilliant explanation. Thanks man
@stevemurphy5709
@stevemurphy5709 Жыл бұрын
Ryan, this is an amazing tutorial. 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❤
@nsgirish
@nsgirish 2 жыл бұрын
Excellently explained. Thanks sir
@linamoussadek6467
@linamoussadek6467 Жыл бұрын
BEST VIDEO !! Deserves so many more likes omgg
@pss_crs
@pss_crs 2 жыл бұрын
Why KZbin 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
@thenomadchronicles
@thenomadchronicles 9 ай бұрын
This was the best video that I watched that makes me really understand Interfaces. Thank you so much!
@reanimatedmanx
@reanimatedmanx Жыл бұрын
I'm going to repeat other commenters, great voice and explanation, very pleasant to listen. GL on the channel! Subscribed
@aaaalord
@aaaalord 2 жыл бұрын
thank you for this great and simple and understandable tutorial
@alexander3293
@alexander3293 2 жыл бұрын
just found your channel. really, really nice content, hope you get more attention!
@ashiqdey
@ashiqdey Жыл бұрын
awesome video man, so clear and crisp
@hectorrios1432
@hectorrios1432 2 жыл бұрын
Really great explanation. Thank you.
@losiu998
@losiu998 2 жыл бұрын
Damn, I watched just one your video and I love the way you explain things. You have radio voice too. Keep doing it!
@OmarAbdelaziz__47
@OmarAbdelaziz__47 2 жыл бұрын
Very informative, Please keep doing more about golang topics, your explanation is quality.
@jorgesilva932
@jorgesilva932 Жыл бұрын
Great explanation, thank you !
@shivangitomar5557
@shivangitomar5557 2 жыл бұрын
You are amazing! Love the way you teach
@rban123
@rban123 2 жыл бұрын
Crimininally underrated channel
@justellvonk2518
@justellvonk2518 Жыл бұрын
Thank you so much for your videos! Your explanations are so great! :)
@numbr6
@numbr6 2 жыл бұрын
Nice. Thanks for sharing your knowledge.
@varpen
@varpen Жыл бұрын
What a great video! Thank you.
@MrTyty527
@MrTyty527 Жыл бұрын
Giving tutorials without leaving bed haha, good one!
@johnr3936
@johnr3936 4 ай бұрын
Awesome explanations.
@isurukdniss
@isurukdniss Жыл бұрын
Wow! what an explanation. Please make more videos on Golang
@nassehk
@nassehk Жыл бұрын
Man I am gonna use this video in my meditation! It is so relaxing dude...
@Peggysue_zSut
@Peggysue_zSut 2 жыл бұрын
What an amazing teaching. :)
@EpicMicky300
@EpicMicky300 Жыл бұрын
this dude's the golang goat! best tutorials from a bed, confirmed.
@gelbander
@gelbander Жыл бұрын
Great work on this! 🔥
@sondosabd9474
@sondosabd9474 Жыл бұрын
Thank you very much for this tutorial
@solojazz75
@solojazz75 2 жыл бұрын
Ryan, this is one of the most useful video I have seen on this topic. Thanks. a quick question, I need to collect data from multiple wss, and sort of concatenate the data, do you think a channel would be good for that? (think market data). Cheers
@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
@someone5781
@someone5781 2 жыл бұрын
This is a great explanation Ryan! Would you consider making a full golang tutorial? :)
@khayrulislam752
@khayrulislam752 2 жыл бұрын
So helpful. Please make a playlist.
@nicknick65
@nicknick65 2 жыл бұрын
laid back and perfect, just subscribed
@rahulgarai4822
@rahulgarai4822 11 ай бұрын
Nice explanation 👍. liked it...
@Simas1234
@Simas1234 Жыл бұрын
This was helpful, thanks Ryan
@a_maxed_out_handle_of_30_chars
@a_maxed_out_handle_of_30_chars 2 жыл бұрын
simple and sweet, thanks :)
@arthurmastropietro5261
@arthurmastropietro5261 8 ай бұрын
Great job, love it!
@goldenboy_808
@goldenboy_808 Жыл бұрын
This was a really good tutorial hope you do more
@A.A.
@A.A. 2 жыл бұрын
that was super cool explanation
@mehdiboujid8761
@mehdiboujid8761 2 жыл бұрын
i really was waiting for something like this specially from you thank you very much keep it up !
@gustavodeloloalmeida
@gustavodeloloalmeida 2 жыл бұрын
the best explanation i have ever seen (i saw maybe 20 videos kkk). You earn more one follow. Excelent Job !!!!
@namename8986
@namename8986 Жыл бұрын
honestly best tutorial in golang. make more stuff plz
@AhmedAli-go7wx
@AhmedAli-go7wx Жыл бұрын
Great explanation ,,,thanks
@MobileWTF
@MobileWTF Жыл бұрын
You're meant to teach man, great job! Thank you
@kasoivasoy7808
@kasoivasoy7808 11 ай бұрын
Thanks, Morgan!
@markcampanelli
@markcampanelli Жыл бұрын
Thanks for the great explanations. My only issue is that the Wells Fargo bank account didn’t have any fees. That’s completely unrealistic 🤣.
Advanced Golang: Generics Explained
13:37
Code With Ryan
Рет қаралды 54 М.
Golang Channels Or Wait Groups? Let Me Explain.
18:32
Anthony GG
Рет қаралды 16 М.
¡Puaj! No comas piruleta sucia, usa un gadget 😱 #herramienta
00:30
JOON Spanish
Рет қаралды 22 МЛН
Do you have a friend like this? 🤣#shorts
00:12
dednahype
Рет қаралды 45 МЛН
格斗裁判暴力执法!#fighting #shorts
00:15
武林之巅
Рет қаралды 88 МЛН
Day 7 of Framer Discovery Streams
1:10:16
Xperian School
Рет қаралды 31
Master Golang with Interfaces
21:54
Kantan Coding
Рет қаралды 4,5 М.
Understanding Contexts in Go in 5(-ish?) Minutes
15:14
TutorialEdge
Рет қаралды 57 М.
Goroutines Crash Course (Mutex, Channels, Wait Group, & More!)
15:42
Ben Davis - Tech
Рет қаралды 16 М.
Tutorial: Do you really think you understand Go interfaces?
11:38
Learn Go Programming
Рет қаралды 63 М.
The standard library now has all you need for advanced routing in Go.
13:52
Don't Use Websockets (Until You Try This…)
6:46
Code With Ryan
Рет қаралды 281 М.
Master Go Programming With These Concurrency Patterns (in 40 minutes)
46:15
What is Span in C# and why you should be using it
15:15
Nick Chapsas
Рет қаралды 247 М.
How To Structure Your Go App - Full Course [ Hex Arch + Tests ]
2:45:06