According to the latest Octoverse report by Github, Kotlin has seen 2.6x growth in contributions as of September 2018 and is already becoming the go-to programming language for Android development. Understand what has made it inevitable.
Kotlin got big when it acquired the backing from the search engine behemoth at Google I/O 2017. It is now the official programming language for Android development besides Java and C++ and #4 most loved languages in the tech world. (Source: StackOverflow)
Initially, when Kotlin was rolled out, most experienced developers started giving it a try. However, since it has been made the official Android language, more students and developers are moving towards Kotlin to build apps.
Around 80% of Developers are using Kotlin to build Android apps. About 31% use it for backend/server-side applications, while another 31% said they used it for SDK/libraries.
Kotlin has been around 2010. JetBrains developed it to solve their own, internal development & productivity challenges. They are a software development company, and their core area of expertise is — IDEs. The basis of an IDE is a programming language. The first version of Kotlin came out in early 2016. And, since then Kotlin has been witnessing exponential growth.
Why was Kotlin built?
Almost 70% of JetBrain’s products are built with Java. Slowly and gradually the company was getting tired with the old fashioned ways of writing code. With Java, even a fundamental thing like “Hello World” would require any developer to write three lines of code whereas modern languages can do this in about three words.
This means more repetitive work. What JetBrains needed was a new language compatible with Java that would translate to adding new features to existing apps without rewriting things from scratch, and that is less code. They tried Scala, but it was not as fast as they wanted it to be.
That’s how they built Kotlin.
If you are into Project Management and Team Communication, chances are you use ‘Basecamp’. The company has been one of the earliest adopters of Kotlin.
A third of the Android app’s code was Kotlin-based back in May 2016 (it’s now 100% Kotlin). The code is better, users are happier (the ultimate goal for any developer) and so are the programmers. What’s going on, you might ask?
Dan Kim, the android guy at BaseCamp, found himself uttering ‘holy-shit’ quite a few times when he started writing code using Kotlin.
A popup adapter was his first Kotlin class. He completed it in 86 lines. The code was concise, readable and more importantly, he had fun writing it. Less was, indeed, More.
Next, while converting an existing helper class, he just reduced 94 lines of code.
He had just fallen in love with a programming language and as a developer myself, I can tell you how hard it is to love a language.
Here are some of his favourite Kotlin features which they regularly use at Basecamp.
Interestingly, he also shares how Kotlin has made him a happy programmer.
As developers, we want to use frameworks/languages to come up with creative solutions to business problems than just cranking up some boilerplate code.
Writing code that’s concise, clear, and expressive makes me happy. Focusing on creative solutions to business problems, not boilerplate and ceremony, makes me happy. Feeling an intense motivation to learn, which was missing in the Java days, makes me happy.
And that’s super important. Because being happy isn’t just good for the soul. It’s great for your programming skills too.
The more capable and friendly your language is, the happier you are. The happier you are, the better code choices you make. The better code choices you make, the better habits you build. And the better habits you build, the better programmer you become!
This is exactly what’s happened with Kotlin and me over the past year. And I’m a better programmer because of it.
Read more about his thoughts on Kotlin here.
Christina Lee is an Android Engineer, and she was one of the first, few people at Pinterest to try Kotlin for the video pin feature. She says, “working with it will bring a smile on your face.”
Any organization/company that has been using Java for years can quickly find itself in a quagmire — whether to continue using Java or try Kotlin? Because Java can do everything that Kotlin can. Millions of apps, today, are still baked with Java and continue to function well.
The difference is that Kotlin speeds up the development. How?
With more straightforward and easier to read code. No more using that boilerplate code.
Kotlin sure has a more beautiful syntax, but it’s not about the features and functionalities any more. These features ensure that you have a more productive development environment.
The Kotlin-based feature was introduced to approx. 150M users a month.
Kotlin is not a radical departure from Java, as both produce bytecode for the JVM. But what makes it so nice to work with is that it is essentially a version of Java where best programming practices have been built into the language, so it is much easier to do the right thing than it is to do the wrong thing. This allows a developer to code with speed and confidence and removes much of the rote work that had been required while using Java.
Because coding, like writing, is an expressive art form, having a tool like this that allows you to express your thoughts clearly, quickly, and accurately is a satisfying phenomenon and one worth getting excited about. When you combine this with the industry-leading tooling and interoperability of the language and the thorough and thoughtful language leadership displayed by the team at JetBrains, it was difficult not to fall in love with it.
Listen to her thoughts here
When Valeriy Ovechkin joined the Caviar team as a software engineer, the app was 100% Java. He started experimenting with Kotlin as a ‘passion project’ and pitched to the ‘Square’ team that it will make the development faster.
When the existing features were rewritten in Kotlin, there was no significant impact on the end-users. But for developers, it was a game-changer.
With Java, coding can be slow, and results can be clunky at times.
Valeriy, gradually, started writing the new features in Kotlin because it’s easier to learn and makes the whole experience delightful. Writing fewer lines of code is what makes developers stick around.
“What is interesting with Kotlin is basically it leverages the existing skills of Java developers and finds the right tradeoffs to provide new features and provide things that make Java developers more efficient without going too far,” — Pivotal engineer Sébastien Deleuze
According to Ovechkin, the code (for Caviar’s Android version) is smaller by 15–25%. That’s because — Kotlin allows you to write concise, smaller amounts of code which results in easier management. Developers can focus on more significant problems than routine tasks.
From Uber to Atlassian, biggies across the globe are using Kotlin to power their apps, back-end etc. Its usage will only grow in 2019.
- Low Risk — Start small by rewriting an existing feature of your app and see how it goes. Have it as a side project and see how your users react. This means your entire product does not need to invest much in the beginning. It is possible because Kotlin classes export a Java API which is similar to Java code.
- Active support community — Kotlin is backed by Google and has become the official language for developing Android apps. There are tons of resources, talks and community help available to solve your queries regarding anything you feel stuck at.
- Open source — You don’t need to purchase Kotlin. It’s freely available. If you know Java and C++, you can quickly develop your MVP and start testing your idea before investing full-fledged. You can crank out the best MVP within limited time and budget.
- Efficient teams — When your team has to code less, it becomes more productive. Use their time efficiently to work on bigger, better issues than just code usual, routine stuff. It saves their time. It helps them work faster and better.
- Easy on maintenance — Less code, less maintenance, fewer nightmares. Additionally, there are tons of IDEs available for your developers, let them choose the SDK/toolkit of their liking.
- Compatible with previous versions — Ask any Android developer, and you’ll know the pain point I am talking about. Kotlin is 100% backwards compatible.
- No more memory leaks — The last thing you would want on your app is impaired performance. Kotlin helps avoid memory leaks.
- Interoperability with Java — Old projects working on Java? Never mind. Continue working on them with Kotlin.
We strongly suggest you start using Kotlin for your android apps. At Solutelabs, we too have shifted from Java to Kotlin for building products for our clients, and they have been more than happy with the result. Start taking small steps today to reap big benefits tomorrow.