When you say Android programming, the chances are that the first programming language that comes to your mind is Java, and rightfully so. But since Google announced they now started to support Kotlin as Android’s official language, the situation is likely to change in the future. Nevertheless, just like Kotlin programming language has raised a few questions.
One of them asked both by seasoned professionals and new entrants on the market for Android apps, is whether it’s smart to make a transition to this latest craze of a language or stick to the traditional and well-known Java.
After weighing all the upsides and downsides of Kotlin here we’ve come up with the following review. We have also got enormous help from Ms. Abby Adams, the senior business analyst at Itransition (a software development company), to find out all bright and dull sides of Kotlin programming language. So, if you consider joining such tech giants as Atlassian, Pivotal, Pinterest, Evernote, and Uber, make sure that you understand all the benefits and possible shortcomings of this language.
The Sunny Side of Kotlin Programming Language
100% Java interoperability
One of the main strengths of this programming language is its compatibility with Java. Kotlin goes well with all Java-based components and therefore enables Java-to-Kotlin migration. It’s not altogether impossible to bring Java and Kotlin together within one project with no downsides to it; the software development company Itransition has seen in its practice.
Due to this feature, you can try and launch a pilot programming project on a fraction of your code. In case of success, you could transfer to Kotlin gradually, or introduce Kotlin only in the new components from then on.
Recommended for you: Java Programming: The Core Concepts of Java Development.
Fewer bugs and increased productivity
Unlike Java programming, Kotlin is the language with a clean and powerful syntax. This usually results in 25–35% less source code, while the generated bytecode remains about the same size and efficiency. This feature should make coding in Kotlin a much more enjoyable experience. As you can see, Kotlin can contribute to your team’s efficiency considering that it takes noticeably fewer efforts to create and implement new code.
Also, by being more concise and cleaner, Kotlin enables developers to deliver a more stable code that contains fewer bugs. Also, as all the errors are detected during compilation, Kotlin appears to be safer than Java.
Since Kotlin tends to be an improved option for Java-based programming, it takes a reasonable amount of time for developers to learn it. They will find that many skills they acquired throughout their Java career apply to their Kotlin projects. For Java developers, most of the Kotlin syntax will feel familiar. And if in some cases, Java developers encounter a code that differs significantly, they can still comprehend it thanks to Kotlin’s intuitive and easy-to-read design.
Outstanding compatibility with Android Studio
Kotlin has been developed by the creators of IntelliJ, which is the base for Android Studio, the third most popular IDE with just under 10% share and almost 9% growth in the last 5 years according to the PYPL Index. Thus, Android Studio provides top compatibility with Kotlin.
Android Studio can read, compile, and run Kotlin-based code easily. Using it, developers can also fix bugs, use auto-complete, navigate the code, carry out unit testing, and fully refactor Kotlin. Java-to-Kotlin conversion is also possible after your Android Studio project is configured to support Kotlin programming language.
Although it has been officially acknowledged by Google only recently, Kotlin was initially introduced in 2011. Since then it has been polished and tested thoroughly before its ultimate release, which makes it a mature and reliable programming language.
Kotlin Programming Language: On the other hand…
Besides all the mentioned advantages, Kotlin has its flaws that need to be taken into consideration before making the transition.
Larger file package size
One of the main drawbacks is that the size of .apk grows heavily due to the runtime and the Kotlin Standard Library. The additional size makes less than 1 megabyte; but for large apps, this extra size can result in fewer downloads eventually.
According to some developers, another downside of Kotlin is its slower compilation speed. Although Kotlin programming language is faster than Java in this regard, sometimes it´s slower indeed.
Its true Kotlin is clear and concise, but at times it can be difficult to decipher some bits because they’re so tightly packed. In comparison, some unfamiliar bits of Java is easier to comprehend.
This simply means that unfamiliar Java code is easier to decipher than that’s unfamiliar in Kotlin.
You may also like: 5 Best Programming Languages for Mobile App Development.
Less professional support yet
Kotlin programming language is still in its early adoption phase, and the community surrounding it is only starting to form. If you think about becoming a Kotlin developer, you couldn’t find many helpful materials out there, including developers’ manuals and forums.
Lack of professional workforce
There’s still a lack of professional Kotlin developers because the language is young. Still, the number of Kotlin-related vacancies is steadily going up.
So, is Kotlin programming language better than Java?
That being said, in certain aspects Kotlin is better than Java; in others, it still cannot compete with its predecessor. But will you choose a concise syntax and increased productivity with outstanding Android Studio support over a smaller file package size and faster compilation speed with an established support community? Let’s discuss your opinion on which is better in comments.
1 thought on “Ups and Downs of Kotlin Programming Language – Is It Better than Java?”
Thanks for the article, let me express a different point of view on some of the items.
On the pro side, I’d say on the “stress-free learning” that Kotlin, while being inspired by C# and Java, has a large number of idioms and significant differences in behavior that should not be underestimated, for example, the improved yet different visibility scopes or little things like .equals vs ==. It’s OOP like C# and much more than Java, but you still have to learn the language before hoping to be proficient.
On the con side, I’m not sure this was clearly stated: “downside of Kotlin is its slower compilation speed. Although Kotlin is faster than Java in this regard, sometimes it´s slower indeed.”. Err? Is it slower or faster in the end? What has been demonstrated is that the run-time is usually faster except some features. The slower compilation is not a huge problem, and hopefully, the compiler will get optimized in due time.
Code readability, I think there is no doubt here that Kotlin is actually much clearer than Java. Firstly, it is more concise without being enigmatic – it’s not Perl code. It is possible to write a mess like any other language, but conciseness has never been a synonym of confusing. Secondly, it brings many constructs that would be expressed in lengthy or awkward code in Java, take for instance the default function arguments, or the equivalent of Linq expressions that Java completely botched in version 8, and which is neat and coherent in Kotlin. The only mess they couldn’t fix is type erasure, which was one of the first and biggest mistakes in JVM, and unavoidable for compatibility reasons.
For the rest, package size and adoption, they come together and just need time. One real potential drawback I see is the development being in the hands of one company alone, but like Microsoft with C#, they seem to know what they are doing, so it doesn’t bother me.