Coroutines: Concurrency in Kotlin

  Рет қаралды 23,711

Dave Leeds

Dave Leeds

Күн бұрын

Пікірлер: 103
@androidexpert7319
@androidexpert7319 2 күн бұрын
Dave is an amazing story teller and teacher. Thanks for this video
@tonyseben
@tonyseben 6 ай бұрын
Hands down the best explanation on Coroutines on the internet! The analogies and the illustrations are on point.
@typealias
@typealias 6 ай бұрын
Wow, thanks so much, Tony! I'm glad you liked it!
@sureshsivalingam01
@sureshsivalingam01 6 ай бұрын
I think you're the best underrated youtuber on android development videos
@typealias
@typealias 6 ай бұрын
Hey, thanks so much, Suresh - I appreciate that!
@CHOCHY
@CHOCHY 4 күн бұрын
Great video, great work 🎉
@milleniumtv908
@milleniumtv908 6 ай бұрын
Hi, I love how u make describe things, very concise and understandable. Please keep posting more. Love u
@typealias
@typealias 6 ай бұрын
Hey, thanks so much! Glad you enjoy it.
@doboshmichael
@doboshmichael 6 ай бұрын
Absolutely! It's definitely an underestimated skill - being able to describe things in simple words
@mithileshdhupia2533
@mithileshdhupia2533 6 ай бұрын
Best video i ever watched on coroutine
@typealias
@typealias 6 ай бұрын
Wow, that's kind of you to say that! Thank you so much!
@paulmcburney6874
@paulmcburney6874 24 күн бұрын
Professor teaching mobile (therefore Kotlin) here - Absolutely fantastic metaphor and code examples. You really covered a ton of use cases for threads here, thank you so much for it! Linking this in our lecture notes!
@typealias
@typealias 24 күн бұрын
Thank you so much, Paul! I'm glad you enjoyed it (and honored to be included in the lecture notes)!
@fabricioaraujo7642
@fabricioaraujo7642 5 ай бұрын
This channel are slowly became the best content about kotlin stuff in yt ! Congrats
@typealias
@typealias 5 ай бұрын
Wow, thank you so much, Fabricio! I appreciate it!
@nixoncode
@nixoncode 6 ай бұрын
Really beautifully explained concurrency concepts
@typealias
@typealias 6 ай бұрын
Thank you so much, Nixon!
@JaganathanG
@JaganathanG 6 ай бұрын
Your explanations, illustrations, and key points are all put together so well; it’s a beautifully orchestrated presentation. I wish you had been my college tutor.
@typealias
@typealias 5 ай бұрын
Wow, thank you so much! I'm so glad you liked it!
@isidrorodriguez2833
@isidrorodriguez2833 12 күн бұрын
This is gold! Best video I've seen about coroutines.
@electrick5182
@electrick5182 6 ай бұрын
Thank you for sharing this kind of video! The story telling and the overall presentation makes it easy to understand these concepts. Keep it up mate! So glad your video appeared on my Home page :)
@typealias
@typealias 6 ай бұрын
Hey, that's great - I'm so glad you found this style of presentation effective! I'll definitely keep it up! 👍
@blackdoom_
@blackdoom_ 28 күн бұрын
thank god, a person who explains a complicated topic in plain english without an incomprehensible damn accent
@StefanoGroenland
@StefanoGroenland 5 ай бұрын
You’re awesome 🎉 I haven’t learned a new language this fast, ever before! You sir are great at explaining! Keep this up!!
@typealias
@typealias 4 ай бұрын
Oh wow, that's really great to hear - really glad that you're picking it up so quickly! I'll keep at it!
@filipbeban
@filipbeban 6 ай бұрын
Great job, Dave, as always!
@abdushakoor0099
@abdushakoor0099 6 ай бұрын
2 minutes in the video already love it
@nehaljain8193
@nehaljain8193 6 ай бұрын
You make every concept to understand so easily, Thanks a lot :) Keep posting :)
@typealias
@typealias 6 ай бұрын
Thank you, Nehal! I'll keep at it!
@loveyouself5389
@loveyouself5389 5 ай бұрын
Wow! Please do more✨
@sawyannaing8594
@sawyannaing8594 4 ай бұрын
I have been struggling for a long time for what is coroutines,until I see your explanation.Thanks that helps me alot
@typealias
@typealias 4 ай бұрын
That's fantastic! I'm so glad you found it helpful!
@yanfarba4726
@yanfarba4726 4 ай бұрын
Thank you so much for the great talk! One of the best explanations of coroutine concepts I've seen out there!
@typealias
@typealias 4 ай бұрын
Hey, thank you so much, Yan! I appreciate that!
@phucosg
@phucosg 6 ай бұрын
I would love to see a tutorial on how you created those lovely picture for the demonstration. Your website has always been my recommendation for new joiner of our team to get started with Kotlin.
@typealias
@typealias 6 ай бұрын
Thanks so much! I'd be happy to demonstrate the drawing process - I'll add that to my list of "bonus video" ideas
@mahmoudrizk15
@mahmoudrizk15 5 ай бұрын
Thank You sir. You are the best Kotlin content creator on KZbin NO QUESTION ASKED, they should hand you the diamond play button now❤❤❤❤
@typealias
@typealias 5 ай бұрын
Haha, wow! That's very kind of you to say that 😁 Thank you so much!
@Sanjuanita-x5s
@Sanjuanita-x5s 4 ай бұрын
Such a great explanation. Great job, Dave, as always!.
@ericwathome783
@ericwathome783 5 ай бұрын
You should do more chapters of the book like this. This is very helpful
@PrajwalCanonShutter
@PrajwalCanonShutter 3 ай бұрын
Everything gracefully and with good analogies, explained !
@enos1010
@enos1010 6 ай бұрын
Such a great explanation
@EmmanuelBLONVIA
@EmmanuelBLONVIA 5 ай бұрын
Dave, I've watched several videos of yours and I can tell that you are definitely the BEST Kotlin teacher on the planet. I'll buy your book. If you have a paid Kotlin and/or KMP course, I will also buy it !
@typealias
@typealias 5 ай бұрын
Hey, thank you so much, Emmanuel - that's very kind of you to say! I haven't got any online courses just yet, but I'm planning to start working on them after I put the finishing touches on the book.
@thetechiegarage
@thetechiegarage 5 ай бұрын
This is such a great breakdown on coroutines! Thank you!
@Adyel-YT
@Adyel-YT 5 ай бұрын
The visualizations really helped. Thanks for the great informative video.
@thisissmz
@thisissmz 6 ай бұрын
Great presentation. Thanks for sharing the information. ❤
@typealias
@typealias 6 ай бұрын
You're most welcome!
@ArthurKhazbs
@ArthurKhazbs 5 ай бұрын
Woah! Turns out coroutines are not running on magic! Dave, thank you so much for the great explanation, the captivating story and the wonderful illustrations! Top shelf video, as always on your channel! :)
@typealias
@typealias 5 ай бұрын
I appreciate that, Arthur! Thanks so much! 😁
@oliverweiler8113
@oliverweiler8113 4 ай бұрын
Phenomenal presentation! Thanks for sharing!
@ivanpagac7946
@ivanpagac7946 5 ай бұрын
best tutor ever!!!! clear, to the point
@typealias
@typealias 5 ай бұрын
Thanks so much, Ivan!
@CommanderSteps
@CommanderSteps 6 ай бұрын
Great video, thank you! :)
@guyguy467
@guyguy467 6 ай бұрын
Great explanation
@yasminhaitham9551
@yasminhaitham9551 3 ай бұрын
seriously under rated extreamly support
@shotoneko
@shotoneko 3 ай бұрын
Super! Thanks for this video explanation, Dave.
@kela2812
@kela2812 2 ай бұрын
Thank you for this video! your explanations are so clear
@typealias
@typealias 2 ай бұрын
Thank you so much! I'm glad it was helpful!
@devopsthinh
@devopsthinh 6 ай бұрын
Great talk, thanks, from Vietnam😅😅😅
@typealias
@typealias 5 ай бұрын
Hey, thanks so much! And hello! 🙂
@bernardoslailati
@bernardoslailati 4 ай бұрын
Excellent content! Totally amazing... Congratulations Dave, you're awesome! 🎉👏
@typealias
@typealias 4 ай бұрын
Thanks so much, Bernardo! I appreciate that! 🙂
@cdhiraj40
@cdhiraj40 6 ай бұрын
great explanation! thanks for this.
@typealias
@typealias 6 ай бұрын
Thanks, Dhiraj! And you're most welcome!
@simonmartinelli
@simonmartinelli 3 ай бұрын
Amazing explanation. Thanks a lot!
@flowzk921
@flowzk921 5 ай бұрын
Super Super Awesome! very great story telling!
@ss12p
@ss12p 2 ай бұрын
You’re the best! I was wondering if you could consider making a video on Kotlin Flows. It would be really helpful to see topics like- Flow, StateFlow, SharedFlow
@typealias
@typealias 2 ай бұрын
Hey, thanks so much! That's a great idea - I'll add that to my list for upcoming videos!
@tongcaocuong8223
@tongcaocuong8223 4 ай бұрын
What a great explanation
@archit7606
@archit7606 6 ай бұрын
You have any courses and/or books on Kotlin and Kotlin Multi-platform?
@typealias
@typealias 6 ай бұрын
Hey Archit, thanks for asking! The main content of my book is complete, and I'm working on upscaling the illustrations so that we can get a good print edition of it. You can read it online (typealias.com/start) and there's a Leanpub edition for purchase if you prefer PDF (book.typealias.com). I don't have any courses available yet, but I'm planning to focus on creating them after the print edition of the book is ready.
@archit7606
@archit7606 6 ай бұрын
@@typealias Nice! It would be great if you make a complete series titled "Kotlin Multi-platform for Java Developers"! ❤️
@haukekonradcoding
@haukekonradcoding 6 ай бұрын
Great explanations. Where are your cool cartoons from, did you create them yourself?
@typealias
@typealias 6 ай бұрын
Thanks so much - I'm glad you like the cartoons! Yes, I created all the illustrations in this video. Cartooning has always been a hobby of mine, so it's fun getting to combine my drawing and programming interests into my videos and articles. 😁
@letscode7229
@letscode7229 25 күн бұрын
One of the best
@MuhammadSalmanAziz-o4z
@MuhammadSalmanAziz-o4z 18 күн бұрын
What an explanation
@MuhammadDaif
@MuhammadDaif 5 ай бұрын
This is art ! :-)
@AsifKhan-v2n7o
@AsifKhan-v2n7o 6 ай бұрын
Highly Recommended #trending
@PedroBarbosaRoman
@PedroBarbosaRoman 5 ай бұрын
Thank you for the great presentation! I have question related to the first coroutine example: shouldn't the second coroutine have a yield() as the first line of the block, since the order of the coroutines is not guaranteed and so the Hammer clothesline could run before the Sledge suplex? With the first yield we ensure that the first line of code of the first launched coroutine will always run first. Does it make sense?
@typealias
@typealias 5 ай бұрын
Hey, thanks so much, Pedro! I believe that isn't necessary here because we're just using runBlocking's event loop as the dispatcher, which - at least in practice - processes them first-in-first-out. If we add yield() at the beginning of that second launch, we'll see two moves from Sledge before Hammer does anything. Let me know if you do get different output than that, though!
@PedroBarbosaRoman
@PedroBarbosaRoman 5 ай бұрын
​@@typealias Yes, you are correct! It seems that the runBlocking runs the first coroutine until it finds a yield() or some other function that also yields like a delay() or the coroutine ends, before even running the second one. I tried using a while loop that does nothing in the first coroutine without yielding and the second coroutine wasn't even started which indicates the behaviour you described! Also tested runBlocking with a Dispatchers.Default and the behaviour changed so this is due to the event loop runBlocking uses. Thanks for the clarification!
@typealias
@typealias 5 ай бұрын
Okay, fantastic - thanks for taking the time to confirm that, Pedro! And of course, in most real-life scenarios, I'm sure it's a good idea to keep in mind that the order isn't guaranteed, as you mentioned. 👍
@jameslorenzen2610
@jameslorenzen2610 3 ай бұрын
Question: In the Parallelism chapter, prior to adding the `Dispatchers.IO` to the `async` coroutine builder, the calls to `order` were running "currently" and not in "parallel"? Well, actually let me take that back. Since both order calls use the same Dispatcher, they will execute concurrently since they are using the same underlying thread pool. Is that correct?
@typealias
@typealias 3 ай бұрын
Hey James! If we don't specify a dispatcher to use when calling a coroutine builder, the coroutine inherits the dispatcher from its parent. So, in the code at 16:45, the two `async` coroutines and the `launch` coroutine are just inheriting the dispatcher from `runBlocking`, which is using a blocking event loop that's just running on the `main` thread. Once we get to the Parallelism chapter, we actually start using thread pools. Hope that makes sense!
@jameslorenzen2610
@jameslorenzen2610 3 ай бұрын
@@typealias So prior to the Parallelism chapter, things are running "concurrently", right?
@typealias
@typealias 3 ай бұрын
Yes - starting at 8:54 when we first call yield(), things run concurrently until we get to the Parallelism chapter. And prior to 8:54, it's just good ol' fashioned sequential code.
@ПавелГладков-р7ы
@ПавелГладков-р7ы 6 ай бұрын
Добрый день. Все кирпичики становятся на свои места )) Кажется вам очень нравится Котлин?
@typealias
@typealias 6 ай бұрын
That's great! Yes, I've been very happy with Kotlin!
@Charles-EddyPARPET
@Charles-EddyPARPET 6 ай бұрын
Hello, I'm wondering if you are okay that I use your illustrations and explanations for a Kotlin training I'm giving in my company? (Of course I'll source the illustrations linking to your typealias website)
@Charles-EddyPARPET
@Charles-EddyPARPET 6 ай бұрын
By the way, that was really cool explanations of the concept of coroutines. :-)
@typealias
@typealias 5 ай бұрын
Hey Charles, thanks for asking! Would you be able to send me a direct message on X (x.com/djleeds), LinkedIn (www.linkedin.com/in/daveleeds/), or Kotlin Slack (djleeds)? Happy to follow up with you there!
@Das.Kleine.Krokodil
@Das.Kleine.Krokodil Ай бұрын
good
@Khl8122
@Khl8122 Ай бұрын
Nice transition from wwf to www (sort of)
@shahidzbi
@shahidzbi 6 ай бұрын
Head Down Sir what's an Explanation Guys let's make that Skyscraper by hitting the Subscribe Button ❤
@typealias
@typealias 6 ай бұрын
Haha, thanks so much Shahid! I appreciate that! 😁
@shahidzbi
@shahidzbi 6 ай бұрын
❤🎉
@disciplinaremorso
@disciplinaremorso 2 ай бұрын
@Chriptus
@Chriptus 6 ай бұрын
Instead of runblocking at entrypoint of the application we should declare main as suspend
@typealias
@typealias 6 ай бұрын
We can do that, but then we won't have a coroutine scope upon which to call launch(). So we'd have to wrap the launch() calls in a `coroutineScope {}` block. In other words, we'd end up replacing `runBlocking {}` with both a `suspend` modifier and a `coroutineScope {}`. For this video, that would have been a lot of concepts to introduce just to run our first coroutine, so I stuck with runBlocking. But yes, you can certainly add the suspend modifier to main() if you'd like!
@Chriptus
@Chriptus 6 ай бұрын
@@typealias ya that makes sense for educative purposes to keep few concepts at a time!
@robchr
@robchr 6 ай бұрын
You have a typo where it should be `.also { it.cancel() }`
@typealias
@typealias 6 ай бұрын
Ah, you're right - thanks for catching that! Wish I could update the video with a fix, but KZbin doesn't let you change much. So hopefully anyone who gets stuck on it will notice your comment. 😅 I'll see if I can add an info card or something...
Kotlin Code Reuse: Composing like you're Inheriting
14:42
Dave Leeds
Рет қаралды 11 М.
The Essence of Coroutines
8:10
Dave Leeds
Рет қаралды 14 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
Роман Елизаров - Корутины в Kotlin
59:04
JPoint, Joker и JUG ru — Java-конференции
Рет қаралды 67 М.
10 Signs Your Software Project Is Heading For FAILURE
17:59
Continuous Delivery
Рет қаралды 38 М.
Every Kind of Class in Kotlin
10:44
Dave Leeds
Рет қаралды 17 М.
Coroutines and Loom behind the scenes by Roman Elizarov
45:22
Kotlin by JetBrains
Рет қаралды 34 М.
Kotlin Coroutine (High-quality Course)
2:07:37
Smartherd
Рет қаралды 111 М.
The World Depends on 60-Year-Old Code No One Knows Anymore
9:30
Coding with Dee
Рет қаралды 1 МЛН
Kotlin Coroutines 101 - Android Conference Talks
24:49
Android Developers
Рет қаралды 138 М.
Inline Functions: inline, crossinline, and noinline
11:59
Dave Leeds
Рет қаралды 8 М.