The state of Kotlin 2019
Tags: kotlin, java
Published: 2019-09-01 14:50:32

---
title: The state of Kotlin 2019

published: true
description: This session will review what is Kotlin, why should we use it, And why programmers love it so much!
tags: #kotlin #java
---

Kotlin History
--------------
* Kotlin v1.0 was released on 15 February 2016
* At Google I/O 2017, Google announced first-class support for Kotlin on Android.
* Kotlin v1.2 was released on 28 November 2017. Sharing code between JVM and Javascript platforms feature was newly added to this release.
* Kotlin v1.3 was released on 29 October 2018, bringing coroutines for asynchronous programming.
* On 7 May 2019, Google announced that the Kotlin programming language is now its preferred language for Android app developers.

What the meaning of “Kotlin”?
-----------------------------
The name comes from Kotlin Island, near St. Petersburg. Andrey Breslav mentioned that the team decided to name it after an island just like Java was named after the Indonesian island of Java[8] (though the programming language Java was perhaps named after the coffee).
![](https://thepracticaldev.s3.amazonaws.com/i/97n16frg32yjma4y7zqc.png)

Why Kotlin?
----------
![](https://thepracticaldev.s3.amazonaws.com/i/royaju9hpqb2611nq7mh.png)
Kotlin is also very easy to learn. It has very short learning curve.


Stack overflow survey 2019 - loved
-------------------------------------------
![](https://thepracticaldev.s3.amazonaws.com/i/34vw7ph7t2tmrszftstm.png)
Source: https://insights.stackoverflow.com/survey/2019

This survey was made before Google announced that the Kotlin as preferred language.

Stack overflow survey 2019 - popular
---------------------------------------------
2019, first time Kotlin get's into popular languages
![](https://thepracticaldev.s3.amazonaws.com/i/xn2wnmxqz3u8dezsa26q.png)
Source: https://insights.stackoverflow.com/survey/2019


GitHub trends - 2018
--------------------
![](https://thepracticaldev.s3.amazonaws.com/i/7hnsm27f831qay1qfijq.png)
Source: https://octoverse.github.com/projects.html

What Kotlin is used for
-----------------------
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1843vppx3hlogyxl3o67.png)
Source: https://pusher.com/state-of-kotlin

Basic Syntax
------------
![](https://thepracticaldev.s3.amazonaws.com/i/ou71ezm904m2bsn0dau9.png)

Data class
----------
![](https://thepracticaldev.s3.amazonaws.com/i/j36do1utwt1uoofh0nux.png)

Extensions
----------
![](https://thepracticaldev.s3.amazonaws.com/i/pb8mcb486kwrtdts3zu5.png)
This is what allows you to call toString() in Kotlin without checking for null: the check happens inside the extension function.

Sequence  vs. Iterable
----------------------
![](https://thepracticaldev.s3.amazonaws.com/i/no57bt8mjqf55367pdc7.png)
With Sequence we inspect 23 nodes vs. 21 nodes with itarable. Obviously, We can save more as the nodes count increases.   

Coroutines
----------
Kotlin's support for coroutines helps build server-side applications that scale to massive numbers of clients with modest hardware requirements.
![](https://thepracticaldev.s3.amazonaws.com/i/s51qxevbocyeeyscom1i.png)
Output:
![](https://thepracticaldev.s3.amazonaws.com/i/mqei5rtcddll6h2kfw1u.png)

Recursion
---------
In Java long recursion is not recommended because of the cost of the stack space. 
In Kotlin we have tail optimization:

![](https://thepracticaldev.s3.amazonaws.com/i/vp3k8zxktbk367hrruaa.png)

Performance
-----------
![](https://thepracticaldev.s3.amazonaws.com/i/ve5j2l7ucov2pwd4idk7.png)

Summary
-------
Kotlin look like a better alternative to Java. It run on top the JVM just like java since it compiles to byte code.
Kotlin is not just for android developers. I use it at my backend server.
It allows me to write cleaner code and to focus at business logic instead of the java technical implementation details and boilerplate code.
Refactoring old java project became much easier (with extensions, class delegation and more) and you can start writing new code in Kotlin while keeping older parts of your system in Java.


More details
------------
https://kotlinlang.org/docs/reference/
https://play.kotlinlang.org/koans/