Developers love Kotlin

Since its humble start back in 2011, Kotlin’s popularity has suddenly skyrocketed.

From Google announcing Kotlin support in Android a year ago, to over 100k respondents of theStackOverflowsurvey voting it the second most loved language, JetBrains’ baby is thriving.

At Pusher, we wanted to learn what’s so special about Kotlin so we decided to dig deeper. We surveyed 2,744 people from January to March 2018 and took the pulse of the ecosystem.

Today, we’re proud to introduce you to the state of Kotlin

The KotlinersThe JourneyThe AdoptionThe KotlinverseThe Future
The Kotliners

01. Younger techies favor Kotlin

Over 70% of our respondents are employees and 11% are entrepreneurs and contractors.

They mostly work in tech - far behind tech are finance, education and digital agencies. Insurance and government are the most conservative in their adoption.

Share this graph
77.2%in tech72.4%employed11.18%freelance15.51%student1.07%otherEmployeesFreelancesStudentsOther
The Kotliners

More than half of our respondents have been working as developers for less than 5 years.

They seem to have slightly less work experience than the people who took the StackOverflow survey. Yet, the trusted old math of "the developer population doubling every 5 years" still holds.

Share this graph

Years working as a developer

Up to 5 yearsMore than 5 years< 1 year1-2 years2-5 years5-10 years10-15 years15+ years8.4%10.4%22.5%33.9%15.2%9.7%0%10%20%30%40%
The Kotliners

The number of people writing Kotlin in organizations varies greatly.

About a third says they have 2-5 people working with Kotlin in their company. This roughly matches the average size of a team developing Android apps.

Share this graph
32.1%2-5 people21.1%1 person20.6%no people13.1%5-10 people9.4%10-50 people3.7%50+ peopleKOTLIN DEVSPER COMPANY32.1%2-5 people50+10-505-102-510
The Journey

02. A success story in the making

Kotlin’s growth has been doubling each year until 2015, when the first massive spike in its usage happened.

Early that year, Jake Wharton released the document advocating Kotlin’s adoption at Square. They are known for creating some of the most popular open source libraries for Android.

As a result, a lot of people followed suit that year, giving talks and writing blog posts about Kotlin.

Share this graph
50%37.5%25%12.5%0%0.1%0.2%0.5%1.4%7.7%19.5%23.7%46.8%20112012201320142015201620172017First halfAfter I/O
The Journey

Adoption absolutely exploded after May 2017.

Google announced that Kotlin was officially supported for Android and a massive number of Android developers started using Kotlin.

This will likely boost Kotlin’s adoption for years to come. Check out the clip for the huge applause. 👏🎉

The Journey

Students and young devs trust Google’s flair.

In its early days Kotlin was being picked up mostly by experienced and professional developers, but since the announcement its usage has exploded with newer developers, especially students.

Share this graph

Adoption among students

50%37.5%25%12.5%0%0%0%0%0.9%3%9%24.3%62.5%20112012201320142015201620172017First halfAfter I/OTotal adoptionAdoption among students
The Journey

Kotlin appeals to developers from varied backgrounds.

Although Java clearly dominates the playing field, our respondents work with many other programming languages. However, a handful of respondents adopted Kotlin as their very first language!

Share this graph

The "source" of developers

and PHP, Ruby, Scala...C++C#SwiftPythonJSJava0%25%50%75%83%23.8%18.3%10.2%8.4%6.3%
The Adoption

03. JetBrains' efforts are paying off

Over 60% active workers currently use Kotlin in their work projects.

By contrast, only a third of the students surveyed use it for work and side projects. That said, almost half of them say they intend to start using it in the future.

Share this graph
YesNoNot reallyNot anymoreCurrently using iton a projectBut I intendto start using itOnly used it to learn/play aroundUsed it on a projectin the past0%20%60%40%TotalEmployeesFreelancesStudents
The Adoption

The official website is by far the most popular resource for learning Kotlin.

Students, however, tend to favor courses on YouTube and Udemy, as well as various conference talks and demos.

These websites will likely be joined by streaming and live coding services such as Twitch in the next few years. 🎥

Share this graph
Onlinecommunities7.74%Jetbrains officialresources53.57%Blogs10.88%Talks &Demos11.75%
The Adoption

A large part of developers program in Kotlin for both their work and personal projects.

Unsurprisingly, Kotlin is more prominent in side projects as they tend to be smaller, easier to convert, and more experimental.

Share this graph

Ratio of Kotlin in your main codebase

100%75 - 99%50 - 75%25 - 50%<25%Completely in KotlinAlmost completely in KotlinMore than a half in KotlinUp to a half in KotlinLess than a quarter in Kotlin0%20%40%60%WorkPersonal
The Adoption

Android is Kotlin's killer app 🚀

Android is hugely ❤️ across the board - used by professional developers and students alike. However, when it comes to backend applications, Kotlin’s users tend to be experienced developers.

Share this graph

What Kotlin is used for

The Kotlinverse

04. Everyone has their favorites

Null safety is a favorite feature for everyone who ever had a NullPointerException in Java - i.e. every Android developer 😂.

4% of diehard Star Wars fans selected “First Order Functions” from the questionnaire — a little “easter egg” that slipped in when The Last Jedi was playing in theatres…

Share this graph
100%75%50%25%0%80.8%64.3%61.4%61%48%41.6%24.8%24.2%2.6%Extension functionsNull safetyJava InteroperabilityData classesHigher orderfunctionsType inferenceMulti platformCoroutinesOther
The Kotlinverse

Extension functions are used across the board.

As confirmed by 77% of respondents, extension functions tend to make code more readable, especially when used in a functional programming context or when creating DSLs. The more experienced the respondent, the more likely they are to use them.

Share this insight

Extension functions use cases

I write extension functions […] so that the algorithm reads top to bottom well
Just for null checks (since we have a Java app)
For clean code mostly. I make their scope as limited as possible unless it is a generic utility extension function.
Almost for everything. Mostly I use internal extension functions to avoid global namespace bloating.
The most important use case is lambda parameters for DSL-style builders.
The Kotlinverse

Besides extending Java classes with Kotlin, people often migrate existing Java code to Kotlin.

Over 87% of respondents have done migrations. Both using a wizard or rewriting code manually are popular techniques.

Out of the 10% of brave souls who migrated entire projects using the wizard, 22% of them were students or had less than one year experience working as software developers.

Share this graph

Migrating Java to Kotlin

ManuallyI rewrote the codeEntire projectWith the wizardWith the wizardWith the wizardSnippets of codeIndividual classes0%20%40%60%80%66%47.7%10.2%56.2%
The Kotlinverse

Over a quarter of respondents who migrated Java to Kotlin needed to revert.

Reasons for reverting are both technical and organizational. Tools that use reflection or generate code have been most often mentioned as technical reasons to revert to Java.

Share this insight

Reasons for returning to Java

Kotlin doesn't let enums contain constants. When creating your own annotations such as your own Android @IntDef it is desirable to store the values inside the enum to keep a clean interface
We were using Realm, and it would not work with data classes.
Struggling to convert Java code that uses Retrolambda/Java 8, due to type loss.
Another team took the code and didn’t want Kotlin - it was an unpredictible move. A very sad conversion.
Not by our choice, made to do it due to organizational rules.
The Kotlinverse

Cross-platform Kotlin is picking up, but slowly.

Only about a quarter of respondents mentioned they used any type of cross-platform support, with most opting for Kotlin/Native, followed by KotlinJS.

Once these features have been out for some time, the adoption will most likely start to pick up. Then, Kotlin might have a fighting chance at becoming the true write once, run anywhere language.

Share this graph
Kotlin/Native15.5%KotlinJS11.7%Kotlin forMulti-platformprojects7.1%
The Kotlinverse

Coroutines are the new official async way do Kotlin. to

Coroutines are labeled experimental, which is why they are rarely used.

They are being used by less than a third of respondents, all which have more than 5 years of experience of working in tech. It’s likely that they have used coroutines with other languages, which is why they feel comfortable using it with Kotlin.

Share this insight

Reasons to use coroutines (or not)

I stopped using it because it’s experimental.
Fully in production for a fintech solution Basically, the core logic of the app is written coroutine style.
I've used it with the library Arrow, they use coroutines to implement for comprehensions.
Currently migrating from CompletableFutures to coroutines. The main use-case is task management in heavy parallel computations.
The Kotlinverse

JetBrains and Android tooling dominates the build tools of the Kotlinverse.

They sit alongside Gradle - the default option for Android projects. The standalone compiler KotlinC barely made the list.

Share this graph

Most used build tools

The Kotlinverse

Similar to coroutines, DSLs aren’t being widely used yet, as they are seen as a more advanced topic.

About 40% of respondents have used a DSL, and out of those people, a quarter developed DSLs themselves

When asked what kind of DSLs they built, over half of the respondents answered highly specific DSLs - for finance, big data, and other fields. Other often mentioned DSLs include helpers specific to Android, and configuration tools.

Share this graph

Most popular DSLs

25%20%15%10%5%0%24.6%17.4%5.6%AnkoKotlin Gradle(.kts)kotlinx.html
The Kotlinverse

Students dig the play on words.

The more experienced developers are, the less they seem to care.

Dinosaurs… 🐊

Share this graph

Replacing Cs with Ks in libraries

50%37.5%25%12.5%0%32.5%47.8%10.2%9.6%*KDE did it 2dekades ago
The Future

#Kotlin2019 and beyond

Kotlin's rapid growth is nothing short of exciting. But can it fulfill all its promises?

Given all the support by both JetBrains and Google, and the almost universal love that Kotlin receives in the developer community, we are sure that the language is not going anywhere. The main question is: will it manage to seriously break into the communities outside of Android?
JetBrains is heavily pushing the multi-platform dream, but will it see sufficient adoption in the following months and years? Will Kotlin become the new standard for web, iOS, or backend developers?

Regardless of this, even if it takes years to expand beyond the world of Android, we’ll still see new generations of developers taking their first steps into programming with Kotlin. They will have a modern, versatile, cross-platform language at their disposal. One that can cross between OO, functional, scripting, and declarative paradigms with ease.
This could mean that Kotlin will affect the wider programming language landscape by becoming a benchmark for what a programming language should be able to do.

One thing is for sure: there are exciting times ahead for the Kotlin ecosystem.
What are your opinions or thoughts? Either on the future of Kotlin itself, or this survey? Either drop us an email, or use the #StateOfKotlin hashtag on Twitter.

Want to shape the next state of Kotlin?

Leave us your email and we'll be in touch when we're running it again*.

*No spam, we promise. Not just because of GDPR, but because we're actually good people.

Still here, and interested in more? Alright!

Find more graphsAccess raw data on KaggleFind out more about Pusher