The Essence of Coroutines

Поділитися
Вставка
  • Опубліковано 7 січ 2025
  • In Kotlin and other languages, coroutines are often seen as just async/await. But the essence of coroutines is much simpler and easier to understand. In this video, I'll boil down coroutines to their most fundamental properties.

КОМЕНТАРІ • 62

  • @henninghoefer
    @henninghoefer 7 місяців тому +21

    So glad to have found this via the Kotlin Slack. Your videos are great at explaining and incredibly well produced!

    • @typealias
      @typealias  7 місяців тому

      Thanks so much for your kind words, Henning!

  • @citizenofearth7319
    @citizenofearth7319 2 місяці тому +2

    Hi Dave, I was trying different books to learn Kotlin... Coming from Java, I wanted something that would give me the essentials of Kotlin... And by accident, I found your book "Kotlin Illustrated Guide".... Wow, in one sitting, I read 6 chapters, and it was just amazing the way it was written and explained.... Thank you so much for your work teaching Kotlin!!

    • @typealias
      @typealias  2 місяці тому +1

      Oh, wow - that's fantastic! I'm so glad to hear that the book has been helpful for you! 🎉 Lots of effort put into it, so it's very rewarding to hear when it resonates well with someone!

  • @LifeLessonsLearned8587
    @LifeLessonsLearned8587 7 місяців тому +4

    I knew!! I will learn something new and your video will not disappoint me. Thanks Dave for the video.

    • @typealias
      @typealias  7 місяців тому

      Hey, that's great, Vivek! I'm glad you enjoyed it! 😁

  • @prasantkumar7693
    @prasantkumar7693 7 місяців тому +1

    I want to express my gratitude for the clear and concise explanation of coroutines.

  • @ChrisAthanas
    @ChrisAthanas 7 місяців тому +5

    Well explained in a unique way that doesn't hide what's happening... kudos!

    • @typealias
      @typealias  7 місяців тому

      Thanks so much, Chris!

  • @thatdougsmith
    @thatdougsmith 6 місяців тому

    So helpful, Dave! Thank you for investing so much into helping the Kotlin community thrive!

    • @typealias
      @typealias  6 місяців тому

      Thank you, Doug! I'm happy to do so!

  • @gabrielm6849
    @gabrielm6849 5 місяців тому +1

    this channel is a mine of gold Kotlin ore

  • @amiref9178
    @amiref9178 29 днів тому

    Thank you Dave. very clear explanation. more in-depth videos explaining coroutines please.

    • @typealias
      @typealias  29 днів тому

      Thanks, Amir! I'm expecting to get to some more coroutines videos in the new year!

  • @vengateshm2122
    @vengateshm2122 7 місяців тому +1

    Coroutines
    Explanation for coroutines is great!!
    Direction Backward > Execution Paused > State Preserved

  • @katarinazzz
    @katarinazzz 7 місяців тому +2

    Amazing explanation! I love your channel, hope you'll keep making more videos

    • @typealias
      @typealias  7 місяців тому +1

      Thank you so much, Katarina! I'll keep at it!

  • @Arkit21
    @Arkit21 5 місяців тому

    Hey Dave,
    This was really great, thanks for making it a fun topic!

    • @typealias
      @typealias  5 місяців тому

      Thank you! I'm glad you enjoyed it!

  • @gb_kash
    @gb_kash 6 місяців тому +1

    So beautifully explained. Thanks Dave

    • @gregandark8571
      @gregandark8571 4 місяці тому +1

      Your avatar is beautiful.

    • @gb_kash
      @gb_kash 4 місяці тому

      @@gregandark8571 Thanks. It somewhat depicts the place I live in.

  • @cppgohan
    @cppgohan 5 місяців тому

    How to use internal low level createCoroutineUnintercepted directly? I always get "Unresolved reference: createCoroutineUnintercepted" error.
    I only able to use createCoroutine function to implement this kind of stuff.
    Is there any configuartion to let user touch the internal api?

    • @typealias
      @typealias  5 місяців тому +1

      Hello Chao! createCoroutineUnintercepted() is part of the standard library, and you can import it with `import kotlin.coroutines.intrinsics.createCoroutineUnintercepted`. There are two overloads, and they're both public. Keep in mind that they are extension functions on a suspending function, so to invoke one of them, you'll need to call it on a suspending function. To do that, you can either call it on a variable whose type is `suspend () -> T` or `suspend R.() -> T`, or on a suspending lambda directly:
      suspend { /* stuff goes here */ }.createCoroutineUnintercepted(Continuation(EmptyCoroutineContext) {})

  • @akshayprabhu4601
    @akshayprabhu4601 3 місяці тому

    Hi, I am finding this channel so helpful. Thanks a lot. I would request you to create a video on if coroutines did not exist, how we could achieve concurrency, parallelism in Java / Kotlin. I am particularly stuck in correlating between with and without coroutines.

    • @typealias
      @typealias  3 місяці тому

      Thanks so much for the recommendation, Akshay! Are you mostly looking for a comparison between using coroutines and using other approaches - such as futures, promises, etc.?

  • @boschpharma7147
    @boschpharma7147 7 місяців тому

    Hi dave, i just love the way you explain everything like you are teaching a newbie, every time i watch your videos makes my concepts clear, thank you so much, i have 1 request can you please make video series for coroutines, DI type hard to understand concepts in android beginner to advance ???

  • @Doruko666
    @Doruko666 7 місяців тому +1

    Can't get tired of your content, how about talking about differences between interfaces, sealed interfaces and sealed classes?

    • @typealias
      @typealias  7 місяців тому

      Thanks so much! I'll add that to my list of ideas for future videos!

  • @gauravthakkar802
    @gauravthakkar802 7 місяців тому +2

    Dave, what do you do for a living?\

    • @typealias
      @typealias  7 місяців тому +4

      Hi Gaurav! I do software development as an independent contractor, but this year I'm almost exclusively focused on serving the Kotlin community, exploring whether it's possible to make that a sustainable business.

    • @akshayprabhu4601
      @akshayprabhu4601 3 місяці тому

      @@typealias It is possible to make a sustainable business. We do not know many more things that you know.😛 So we are the partners in your business

  • @L4szcZ
    @L4szcZ 7 місяців тому +10

    I am learning few years already and still thinking I am dumb

    • @typealias
      @typealias  7 місяців тому +14

      In the software development industry, there's always so much more to learn. That feeling of inadequacy is pretty common, even across different experience levels. Just stay honest about what you know and what you don't know, always be willing to learn more, and stay focused on learning the things that will be the most helpful for you.

    • @LifeLessonsLearned8587
      @LifeLessonsLearned8587 7 місяців тому +1

      This reminds me of the quote "If you can't explain it simply, you don't understand it well enough." - Albert Einstein.

    • @ChrisAthanas
      @ChrisAthanas 7 місяців тому +1

      It's like that the whole damn way, that's why understanding each part takes time and builds on the previous... you either like that process and just keep going or you hate it and quit.

  • @guyguy467
    @guyguy467 7 місяців тому +2

    Very nice explanation. Thank you

    • @typealias
      @typealias  7 місяців тому +1

      Thanks so much, Guy!

  • @gamarmustafa
    @gamarmustafa 7 місяців тому +1

    hey Dave! will you be selling physical version of your book? I would love to buy one if you did)

    • @typealias
      @typealias  7 місяців тому +3

      Hey, thanks for asking! Yes, I'm planning to make a print edition available after the digital version is complete. I'll need to finalize Chapter 20, add a few appendices, and rework some images for better print quality - so it might be a few months out yet, but I'm looking forward to it!

    • @gamarmustafa
      @gamarmustafa 7 місяців тому

      @@typealias great news😍. can't wait)

  • @BLIHOK
    @BLIHOK 7 місяців тому +1

    I really like this video. Thank you!

    • @typealias
      @typealias  7 місяців тому

      You're most welcome! I'm glad you enjoyed it!

  • @gamarmustafa
    @gamarmustafa 7 місяців тому +3

    great content!🙌🏻

  • @AshuTK
    @AshuTK 7 місяців тому

    Please create more videos like this ❤

  • @andreifigueiredo1737
    @andreifigueiredo1737 3 місяці тому

    Great work, awesome video, I always knew how to use coroutines but did not know to explain why they've worked! Thanks for the explanation!
    Minor critic here, there's a delay on ur voice with the video that bothers me, hahaha

    • @typealias
      @typealias  3 місяці тому

      Hey, thanks so much, Andrei! Wow, ya the audio/video sync on this one is definitely off - that bothers me too! 😅 I've made a few changes to my recording setup and process since this one came out, so hopefully we won't have this problem with the more recent videos!

  • @ZiranVizard
    @ZiranVizard 6 місяців тому

    You have a good deep pleasure voice. Thanks for explaining Coroutines

    • @typealias
      @typealias  6 місяців тому

      You're most welcome!

  • @warTag68
    @warTag68 Місяць тому

    Very well explained. But as a non native-english speaker it's difficult to wrap my head around the meaning of keyword yield in this context

  • @starry_shivam
    @starry_shivam 7 місяців тому

    Great video as always! Btw, can you please tell me which IDE theme you use?

    • @typealias
      @typealias  7 місяців тому +1

      Thanks so much! Yes, the main UI Theme is "Dark", and the Editor Color Scheme is "Darcula". I'm pretty sure I made a few small changes to the levels to increase contrast, but the core colors of the editor are from Darcula.

    • @starry_shivam
      @starry_shivam 7 місяців тому

      @@typealias thanks!!

  • @khouari1
    @khouari1 7 місяців тому

    Great video, thanks!

    • @typealias
      @typealias  7 місяців тому

      Thanks! I'm glad you liked it!

  • @xpynim
    @xpynim 7 місяців тому

    nice 👍

  • @henrik908
    @henrik908 7 місяців тому

    Thank you

  • @shrinivasmanjithaya2112
    @shrinivasmanjithaya2112 7 місяців тому

    This is cool...

  • @Happymaninyellow
    @Happymaninyellow 4 місяці тому

    Wil you be my mentor.

  • @dusilva3796
    @dusilva3796 7 місяців тому +1

    First.

  • @dodalovic
    @dodalovic 7 місяців тому

    Second