The Kotlin Programming Language
Kotlin is a modern programming language created by JetBrains, the makers of the IntelliJ IDEA IDE (and other products). Kotlin first appeared in 2011, was open-sourced in 2012, and is now used by companies throughout the world, including Square, Pinterest, Basecamp, Evernote, and many more.
Here are a few nuggets about Kotlin:
- It’s a high-level language.
- It’s statically typed.
- It has a sophisticated type inference system.
- It’s syntax is concise but still readable. From the Kotlin Language Documentation: “Rough estimates indicate approximately a 40% cut in the number of lines of code (compared to Java).”
- It’s a pure object-oriented programming (OOP) language. Every variable is an object, and every “operator” is a method.
- It can also be used as a functional programming (FP) language, so functions are also variables, and you can pass them into other functions. You can write your code using OOP, FP, or combine them in a hybrid style.
- Kotlin source code compiles to “.class” files that run on the JVM. Kotlin lets you choose between generating Java 6 and Java 8 compatible bytecode.
- Kotlin works extremely well with the thousands of Java libraries that have been developed over the years.
- Kotlin doesn’t have its own collections classes, it just provides extensions to the Java collections classes.
- There’s also a Kotlin/Native project “to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS or embedded targets).”
- A great thing about Kotlin is that you can be productive with it on Day 1, but it’s also a deep language, so as you go along you’ll keep learning and finding newer, better ways to write code.
- Of all of Kotlin’s benefits, what I like best is that it lets you write concise, readable code. The time a programmer spends reading code compared to the time spent writing code is said to be at least a 10:1 ratio, so writing code that’s concise and readable is a big deal. Because Kotlin has these attributes, programmers say that it’s expressive.
As a historical tidbit, the name comes from Kotlin Island, which is near St. Petersburg, Russia, where the JetBrains team has an office. Since Java was named after the Indonesian island of Java, the team thought it would be appropriate to name their new language after an island.