Kotlin is a relatively new programming language, developed by JetBrains, the company that stands behind some of the most popular developer IDEs and tools, such as IntelliJ IDEA and ReSharper. JetBrains didn't create Kotlin so that they could make money on it; instead, they started the project because they wanted to solve their own development problems. In 2010, when the project started, Java was the dominant language in their code base. However, the development team wasn't happy with Java and some of its old-fashioned features. They looked for more modern alternatives to Java, but couldn't find one that satisfied their requirements in the existing JVM languages. Scala was popular at the time and was considered, but it had issues such as slow compile times.
So, they decided to create a completely new language by themselves. Since they already had a huge code base written in Java, rewriting everything in this new language wouldn't have been practical. So, Java interoperability was one of the top priorities.
Preview of the language was released in 2011 and the developer community reacted positively to it. Since then, the popularity of the language has grown rapidly. The language is open source and JetBrains' developers are not the only ones working on it. The project (language, compiler, standard library, tools, and so on) is hosted on GitHub and developers all around the world are contributing to it. Currently, there around 200 contributors to the Kotlin repository. Developers are also adopting it and more and more companies are using it in their production code. Even big companies, such as Atlassian, Square, Uber, and Pinterest, use Kotlin in production. Google also supports Kotlin development. It made Kotlin an officially supported language for building Android apps.
Now that we know how Kotlin started – and that its main goals are great Java interoperability and, at the same time, better productivity than Java – we can say that Kotlin is a general purpose, statically typed, object-oriented and functional programming language, that (primarily) targets JVM. The name Kotlin comes from an island near St.Petersburg, just as Java was named after an island in Indonesia.
In this chapter we will focus on:
- Compiling and running Kotlin
- Kotlin's uses
- Java interoperability
- Build tools
- Setting up the development environment