The dark side of kotlin by Jarek Ratajski

Go beyond the surface-level excitement about Kotlin and delve into its sometimes misunderstood "dark side".

Key takeaways

Misconceptions about Kotlin

  • Language has many “dark corners” and “abuse potential”
  • Overloading operators can be “crazy” and “make no sense”
  • Using the star operator can create ambiguous code
  • Coroutines are not always easy to use and can cause mistakes

Abstraction

  • Abstraction is a process of analyzing something, classifying, and hiding details
  • Too much abstraction can lead to “magic boxes” and “abuse”

Kotlin-specific issues

  • Using var for fields and functions can be confusing
  • Method reference can be used to create “wrapper” functions
  • Lambda expressions can be used in many ways, but some uses may be confusing
  • Type inference can create complex code

Recommendations and thoughts

  • Code should be readable and understandable, not “hacky”
  • Languages should be designed to prevent mistakes
  • Compiler design is important to create a language that is easy to use

General programming thoughts

  • Developers waste hours trying to understand complex code
  • Good code should be simple, straightforward, and easy to understand
  • The key to good programming is understanding abstraction and how to use it effectively.