The secret of KOTLIN success and why should you use it?
If we travel back in time, android development meant Java development. Though there were few other languages to develop android application like Scala, C++, Lua however none of them could stand against Java.
But now whenever we think of android development, Kotlin hits the head.
Other languages fought Java from outside but Kotlin had a centuries old strategy, they did same as Greeks did centuries back.
Guardians of the android were defeated with the greatest strength of Kotlin, interoperability. It stands beside Java, fighting against Java to rule Android.
Interoperability is one of the greatest strength of kotlin. Kotlin programs can use all existing Java frameworks and libraries even advanced frameworks that rely on annotation processing. It is just plug and play easy.
Setup is super easy, once your android studio project is configured to support Kotlin, you’ll even be able to convert an entire Java source file into a Kotlin file, with just a few clicks of your mouse.
It is source of happiness because it is super easy to learn and when you’re done with it. Less code, less time, less bugs, less human errors. You can have lot of time for yourself. Me time :)
Cleaner code which is easier to maintain. Kotlin cuts down the boilerplate code, the scary click listeners, find views by ids. I still remember when my manager asked me for code review, he stopped by the boilerplate code asking me why I write all this mess, making the code unreadable.
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Java the messed up code
}
});view.setOnClickListener {
// Write in kotlin
}
Null Safety is one of the most awaited thing. Android apps often had to suffer and publish a new version if any key in web api is renamed or removed. I always envied iOS developers sitting back and relaxing while me preparing another version. Well it’s time to relax. Kotlin is to rescue.
There are lots of reasons to try Kotlin but one is my favorite.
Why not??? It is free of cost, you don’t need another IDE, and you don’t need another project. It’s new and is here for rescue. You can start by writing simple and small parts of your app getting familiar. It is super easy by the way ;)
Kotlin application runs as fast as an equivalent Java one, thanks to very similar bytecode structure. With Kotlin’s support for inline functions, code using lambdas often runs even faster than the same code written in Java. Kotlin has a very compact runtime library, which can be further reduced through the use of ProGuard. Kotlin supports efficient incremental compilation, so while there’s some additional overhead for clean builds, incremental builds are usually as fast as or faster than with Java.
Kotlin has been successfully adopted by major companies, and a few of them have shared their experiences;
Oh well that happens sometimes when you’re in habit of writing code in Java, you often end up putting semicolons even when not needed. This won’t happen if you code in Kotlin :)
Happy coding.