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).
Why Kotlin?
Kotlin is also very easy to learn. It has very short learning curve.
Stack overflow survey 2019 - loved
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
Source: https://insights.stackoverflow.com/survey/2019
GitHub trends - 2018
Source: https://octoverse.github.com/projects.html
What Kotlin is used for
Source: https://pusher.com/state-of-kotlin
Basic Syntax
Data class
Extensions
This is what allows you to call toString() in Kotlin without checking for null: the check happens inside the extension function.
Sequence vs. Iterable
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.
Output:
Recursion
In Java long recursion is not recommended because of the cost of the stack space.
In Kotlin we have tail optimization:
Performance
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/
Top comments (0)