DEV Community

Discussion on: Kotlin is so nice – it prevents bugs πŸ› before you add them…

Collapse
 
mreichelt profile image
Marc Reichelt

You're right, Kotlin Coroutines are very different from Java Threads. For example, one can write a Coroutine that runs on the same main thread as the regular code (and doesn't use any other threads at all).
My point here was: Coroutines are quite becoming the default to do concurrency operations in Kotlin (especially since Java threads are not available on all platforms), and they fix things that have not been addressed before. Like the aforementioned example of calling a suspend function, but forgetting to handle it correctly.

I think your example is a really good one to show again how Kotlin makes existing Java-APIs easier to handle, and code easier to write, and fewer possible bugs. πŸ‘
I'll link to your comment in the article! πŸ™‚