Kotlin is a statically-typed programming language, created by JetBrains company, located in Russia. Being fully compatible with Java, it runs on the Java Virtual Machine, has readable syntax, and can be compiled to JavaScript source code.
According to Stack Overflow Developer Survey 2018, Kotlin became the second most loved language and the fourth most wanted among the developers worldwide. TechBeacon journalists included Kotlin in the list of 5 emerging languages with a bright future.
Though Kotlin is pretty young, many famous companies have already written their applications in it. Pinterest, a popular image-sharing social service, had decided to move away from Java almost once Kotlin first version was released, and presented pros and cons of using it in 2016, even before Google announced its official support for Kotlin.
Coursera, an educational company offering online courses of remarkable international universities, also chose Kotlin. Other examples of applying it in the creation of famous products are Uber, Trello, Basecamp 3, Shadowsocks, Evernote, Twidere for Twitter, etc.
The creation of Kotlin
Kotlin was invented to solve developer challenges of JetBrains. They needed a simpler tool than Java to work with their main product, called IntelliJ IDEA, totally written in it. The guys investigated the alternatives, stayed unsatisfied, and decided to invent their own language.
The goal was to receive an effective tool that could be used together with Java in custom Android app development and work everywhere where Java works.
The development of Kotlin started in 2010. Six years later, in February 2016, we saw the appearance of the first Kotlin version – 1.0. In 2017, at Google I/O annual conference, Kotlin was announced an official language for Android development.
The key features of Kotlin
Kotlin offers a number of advantages of using/learning it. There are also many things missed in Java and fulfilled in it: Lambda expressions + inline functions, smart casts, extension functions, companion objects, primary constructors, properties, and more.
At the same time, Kotlin programmers have access to all Java frameworks and libraries while having the ability to write more clear and concise code. They can use both languages when building a mobile solution and easily migrate their projects if needed.
Artem Korolchuk, the head of BLAKIT Android development team, named the main Kotlin features:
Null-safety – getting rid of constant NullPointerException is a great thing about Kotlin.
Extension-functions – a useful thing allowing programmers to add the functionality to already existing classes. It also enables to make the code more readable and logical, get rid of static Utils-classes, and write your own DSL.
Coroutines – concurrent programming is getting more and more simple. It seems that Rx and the ability to simply switch between streams had come to us quite recently. But in Kotlin coroutines made it even much easier. Hope, with their help developers, will no longer neglect to perform relatively “heavy” tasks in the background stream, leaving the main one to perform the functions that were originally assigned to it, namely processing, update, and interaction with the UI.
There are many other useful things that involve functional programming (especially concerning the work with collections), delegates, default and named arguments of functions, inline functions… The list is long.)
Noteworthy that Kotlin is rapidly developing and improving: updates, either large or minor are released quite often. For instance, some important updates were implemented in version 1.2. Artem Korolchuk highlighted the main changes that were made:
- Array literals in annotation @CacheConfig(cacheNames = ["books", "default"])
- Checking whether a lateinit var is initialized this::lateinitVar.isInitialized Information from explicit casts is used for type inference val button = findViewById(R.id.button) as Button
- Smart cast improvements
- A set of extension functions was added for manipulating lists fill, replaceAll and shuffle for MutableList, and shuffled for read-only List
Recently, a new version providing substantial updates - Kotlin 1.3 - has been released. You can see what was added and changed in this article.
Also, find out what are the Kotlin advantages and why did we move away from Java to Kotlin.
Top comments (0)