46

Kotlin is not Android - Kt. Academy

 4 years ago
source link: https://blog.kotlin-academy.com/kotlin-is-not-android-c96984730c35?gi=a51e55a80b3
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Kotlin is not Android. “Kotlin does for Java and the JVM what…

“Kotlin does for Java and the JVM what Spring did to J2EE”
— Spring creator at SpringRod

Image for post
Image for post

I have noticed that Android and Kotlin are increasingly becoming synonyms, especially in the minds of IT recruiters.

It’s a very understandable error. They are doing a different job and a good recruiter is not required to know everything that we know, he needs to do his own job well.

But it is wrong.

As you can see on this schema, Kotlin has a larger share of usage in Android than on the JVM. But since the JVM is a bigger platform, the number of Kotlin developers that do Android or something else is roughly similar.

In the Android world, Kotlin is replacing Java

The background on this is that the Android world is becoming fast Kotlin first.

Also there is a very tempting parallel with the Apple/iOS world where Swift is replacing Objective C.

Apple is pushing Swift.

It seems that Google is pushing Kotlin in the exact same way.

Some early articles even used this parallel explicitly:

“Kotlin, the Swift of Android

… but it’s not so simple.

Kotlin was designed for Java and the JVM, not for Android

Kotlin was created by JetBrains, not for Android but for Java and the JVM.

That’s a big difference with Swift/iOS.

The programmers interested in Swift and in iOS/macOS are basically the same.

On the other hand, while Android is a big platform, Java and the JVM is an even huger platform.

This explains neatly that while Kotlin is a big hit on Android, there are still as many or more Kotlin developers that are not programming for Android.

Image for post
Image for post

Source: https://www.jetbrains.com/research/kotlin-census-2018/

Kotlin on Android is all about product-market fit

So why was Kotlin a big success on Android if it was not designed for it?

Simple, it’s a classic example of product-market fit.

JetBrains did not target Android developers.

Android developers world realized themselves quite clearly years ago that programming for Android was broken and needed to change. I wrote about it here:

So Android developers were actively seeking new solutions, trying out everything until they found something that sticks. And one of those things was Kotlin. It started early 2015 when Jake Wharton shared this document advocating for the use of Kotlin at Square

So it was not in fact like Swift which was invented and pushed by Apple for iOS developers.

Instead Kotlin was intended to replace Java, the Android developers discovered and used it first.

Then the Android Framework team decided to follow them.

I am certainly glad they did.

It does open new hopes for making developing for Android less painful.

And also it made the signaling much easier.

This is why dear recruiters you have heard the message that it was OK to use Kotlin in Android.

But in fact it was totally OK even before this was announced.

The Java/JVM world is in a very similar position today

Today it’s perfectly OK to use Kotlin on the JVM.

It’s just that as an IT recruiter you may not be told explicitly to recruit for Kotlin backend developers.

I propose this rule of thumbs:

if Java is a good solution to a given problem,
then Kotlin is also a good and possibly a great solution to the same problem

Update: this rules of thumbs is meant to give a better idea of when using Kotlin can make sense. It is not meant to bash Java.

As clearly explained by Roman Elizarov from Jetbrains, the single most important reason why Kotlin is a great language is that Java got a of the important things right.

I am with Isaac Newton on this:

What Descartes did was a good step. You have added much several ways, & especially in taking the colours of thin plates into philosophical consideration. If I have seen further it is by standing on the shoulders of Giants.

Kotlin for backend programming

In particular Kotlin is a great choice for backend developers.

It has its own very interesting native frameworks like ktor, http4k and more.

And also it is pushed by the Big Guys from Spring and Spring Boot

Kotlin is a great solution because it leverages a decade of practical experience from the Java ecosystem.

In particular coroutines are changing the game because you don’t have to choose between simple code and non-blocking code anymore. Why not both?

Recap

  • There is a lag between when developers start using a technology and when recruiters are told to hire for that technology
  • Android is becoming Kotlin first and 50% of Kotlin developers do Android
  • The Kotlin+Android devs are highly visible and hard to find. If I were looking for an Android developer, I would focus on good Android developers that are currently using Java. Those can be easily learn Kotlin. Learning Android on the other hand is hard.
  • Keep in mind that 50% of Kotlin developers do something else than Android. Those people gets a lot of job offers for doing Android and are getting annoyed by it. So if your company is Kotlin-first on the backend, you may want to do more marketing about it.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK