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.
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 :)
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 !
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.
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.
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! :)
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. 😁
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.
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?
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!
@@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!
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. 👍
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?
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!
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.
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)
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!
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!
Ah, you're right - thanks for catching that! Wish I could update the video with a fix, but TH-cam 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...
Hands down the best explanation on Coroutines on the internet! The analogies and the illustrations are on point.
Wow, thanks so much, Tony! I'm glad you liked it!
I think you're the best underrated youtuber on android development videos
Hey, thanks so much, Suresh - I appreciate that!
Hi, I love how u make describe things, very concise and understandable. Please keep posting more. Love u
Hey, thanks so much! Glad you enjoy it.
Absolutely! It's definitely an underestimated skill - being able to describe things in simple words
Best video i ever watched on coroutine
Wow, that's kind of you to say that! Thank you so much!
Really beautifully explained concurrency concepts
Thank you so much, Nixon!
Thank You sir.
You are the best Kotlin content creator on TH-cam NO QUESTION ASKED, they should hand you the diamond play button now❤❤❤❤
Haha, wow! That's very kind of you to say that 😁 Thank you so much!
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.
Wow, thank you so much! I'm so glad you liked it!
seriously under rated extreamly support
2 minutes in the video already love it
Great job, Dave, as always!
Phenomenal presentation! Thanks for sharing!
You make every concept to understand so easily, Thanks a lot :) Keep posting :)
Thank you, Nehal! I'll keep at it!
You’re awesome 🎉 I haven’t learned a new language this fast, ever before! You sir are great at explaining! Keep this up!!
Oh wow, that's really great to hear - really glad that you're picking it up so quickly! I'll keep at it!
Such a great explanation
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 :)
Hey, that's great - I'm so glad you found this style of presentation effective! I'll definitely keep it up! 👍
Everything gracefully and with good analogies, explained !
I have been struggling for a long time for what is coroutines,until I see your explanation.Thanks that helps me alot
That's fantastic! I'm so glad you found it helpful!
Great explanation
You should do more chapters of the book like this. This is very helpful
This channel are slowly became the best content about kotlin stuff in yt ! Congrats
Wow, thank you so much, Fabricio! I appreciate it!
Super! Thanks for this video explanation, Dave.
Thank you so much for the great talk! One of the best explanations of coroutine concepts I've seen out there!
Hey, thank you so much, Yan! I appreciate that!
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 !
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.
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.
Thanks so much! I'd be happy to demonstrate the drawing process - I'll add that to my list of "bonus video" ideas
The visualizations really helped. Thanks for the great informative video.
This course is very useful to me,thank you.
Great presentation. Thanks for sharing the information. ❤
You're most welcome!
Such a great explanation. Great job, Dave, as always!.
This is such a great breakdown on coroutines! Thank you!
Excellent content! Totally amazing... Congratulations Dave, you're awesome! 🎉👏
Thanks so much, Bernardo! I appreciate that! 🙂
Super Super Awesome! very great story telling!
Great video, thank you! :)
Amazing explanation. Thanks a lot!
great explanation! thanks for this.
Thanks, Dhiraj! And you're most welcome!
best tutor ever!!!! clear, to the point
Thanks so much, Ivan!
What a great explanation
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! :)
I appreciate that, Arthur! Thanks so much! 😁
Wow! Please do more✨
Highly Recommended #trending
Great talk, thanks, from Vietnam😅😅😅
Hey, thanks so much! And hello! 🙂
Great explanations. Where are your cool cartoons from, did you create them yourself?
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. 😁
This is art ! :-)
Добрый день. Все кирпичики становятся на свои места )) Кажется вам очень нравится Котлин?
That's great! Yes, I've been very happy with Kotlin!
You have any courses and/or books on Kotlin and Kotlin Multi-platform?
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.
@@typealias Nice! It would be great if you make a complete series titled "Kotlin Multi-platform for Java Developers"! ❤️
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?
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!
@@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!
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. 👍
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?
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!
@@typealias So prior to the Parallelism chapter, things are running "concurrently", right?
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.
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)
By the way, that was really cool explanations of the concept of coroutines. :-)
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!
Head Down Sir what's an Explanation
Guys let's make that Skyscraper by hitting the Subscribe Button ❤
Haha, thanks so much Shahid! I appreciate that! 😁
❤🎉
Instead of runblocking at entrypoint of the application we should declare main as suspend
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!
@@typealias ya that makes sense for educative purposes to keep few concepts at a time!
You have a typo where it should be `.also { it.cancel() }`
Ah, you're right - thanks for catching that! Wish I could update the video with a fix, but TH-cam 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...