Part 2. Embracing Kotlin
By now, you should be very familiar with using Kotlin to access existing APIs. In this part of the book, you’ll learn how to build your own APIs in Kotlin. It’s important to remember that building APIs isn’t restricted to library authors: every time you have two interacting classes in your program, one of them provides an API to the other.
In chapter 7, you’ll learn about the principle of conventions, which are used in Kotlin to implement operator overloading and other abstraction techniques such as delegated properties. Chapter 8 takes a closer look at lambdas, and you’ll see how you can declare your own functions that take lambdas as parameters. You’ll become familiar with Kotlin’s take on some more advanced Java concepts, such as generics (chapter 9) and annotations and reflection (chapter 10). Also in chapter 10, you’ll study a fairly large real-world Kotlin project: JKid, a JSON serialization and deserialization library. And finally, in chapter 11, you’ll reach one of Kotlin’s crown jewels: its support for building domain-specific languages.