Photo by Fleur Treurniet on Unsplash “Redesigning your application to run multithreaded on a multicore machine is a little like learning to swim by jumping into the deep end.” —Herb Sutter, chair of the ISO C++ standards committee, Microsoft® In this article What are coroutines? Blocking vs. Non-Blocking Kotlin Coroutines Suspending functions CoroutineScope Coroutine builders Coroutine dispatcher Coroutine start Conclusion What are coroutines? Coroutines have been around for quite a time now. They are in-fact one of the ideas which helped develop multitasking operating systems. A coroutine in trivial most is a subroutine or function generalisation which in non-preemptive environment (operating system or OS in short) can voluntarily yield the CPU time so that other such sub-routines can use it for themselves without losing the results of previous computations and then can conti
Photo by Aaron Burden “Truth can only be found in one place: the code.” ―Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship Happy winter, how are you?. This post is continuation of Kotlin series. If you haven't read my introductory post about Kotlin then I'll recommend you reading previous post before continuing with this one. Kotlin is a modern language. I've been working with kotlin for past few months now and I just love it. In todays post I'll talk about three features of kotlin viz. Higher Order Functions, Lambdas and Extension methods. This post also contains working code showing of each of these features. You are free to copy the code and experiment with it. If you haven't already setup kotlin on your system then you can run code using kotlin online playground . Higher order fu