So, what’s the big deal with Kotlin versus Java? Java, the object-oriented language created by Sun Microsystems at the end of the 20th century, has embedded itself throughout virtually all areas of the world’s technology infrastructure in those two decades. Java, Java Beans, Java Virtual Machines, all those Java libraries and frameworks out there have permeated have permeated technology implementations in virtually every economic sector and every technology platform. But every success plants the seeds of its own failure. Things get old. Stale. Not pleasant to deal with, as the world changes around the fading technology star. From such ground Kotlin was born.
First announced in 2011, Kotlin came out of St. Petersburg, from JetBrains, and is currently on release 1.3, and is close to releasing version 1.4. In 2017, Google announced it would be the preferred language for use in the Android marketplace, ensuring the mass adoption of Kotlin in general mobile development culture. Does this have major implications for the number of Java developers out there? Yes, but if you already have solid Java knowledge, it adds to rather than replaces existing awareness.
So, what makes Kotlin so much better that Google recommends using it? Speed of development, less byzantine code, more flexibility in operations, and significantly less legacy overhead, and transparent interoperability with existing Java components. How does that work then? Let’s break them down with some specific examples, taken from the instructor of Lynda.com’s Kotlin Best Practices for Android course, Chiu-Ki Chan.
Interoperability with Java
Kotlin can be used in all places Java is used. Google’s decision to recommend Kotlin for Android app development in favour of Java is very interesting, as Kotlin was designed to gracefully replace Java as the primary language for this massive market.
Concise Code in Kotlin
Kotlin produces leaner code, typically with a lot less defining and function coding needed to build components. This has many benefits, including better readability.
Safe, Economical Code
Kotlin builds in features to prevent writing ”spaghetti code” and also makes it harder to create problems from builds with unspotted memory leaks, crashes, etc. Chiu-Ki Chan, creator of the LinkedIn Learning course Kotlin Best Practices for Android, points out:
Compared to Java it is much more concise and has a much stronger null safety, meaning that you can catch potential crashes much earlier in your development cycle. It is interoperable with Java. You can keep part of your app in Java, migrating to Kotlin at your own pace. On top of that, you can do functional programming in Kotlin, which often makes your code much more concise and much more readable.”
Annyce Davis, author of the LinkedIn Learning course Intermediate Kotlin for Android Developers, says:
Functional Programming Support
Back when Java was first created, the buzz words in the development word were different. Everyone was raving about object-oriented languages and development strategies which promised to revolutionize both the possibilities for software and the ease of adapting existing code for new and changing practices. Fast forward two decades, and the current paradigm that’s hot is Functional Programming (FP), which is a mindset and technique for writing applications and functions faster and more responsively to evolving requirements and priorities, with far less overhead than Java, which bolted on support for FP with Java version 8.
Fail Fast, Fail Often
Kotlin’s compiler (the tool that takes the code and turns it into an executable application) quickly identifies problems with the code and issues with syntax, potential bugs, so developers can fix things fast. Because Kotlin has more built-in functionality than Java, developers spend less time inventing different ways of doing the same low-level functions within the code, reducing what is known as “Technical Debt”, where future developers or maintainers have to figure out the various ways the previous coders structured their components, usually because they were rushed for time, or something changed priority and was left to the end to “clean up” but was left for future coders to fix.
Developer Team Morale Boosting
Java coders who switched to Kotlin get more done, are happier with working with code written by others, have to do a lot less work making sure their code or maintenance gets compiled with few errors, and become more fluent and creative in problem-solving the real work: building great apps that please the end users. Instead of worrying about the tools performing properly, they can transfer more of their intention and skills on the artifacts their tools are building.
Why We Like Kotlin
Kotlin is easier to understand than Java; it has a lower entry threshold.
Code in Kotlin is easier to extend.
Using Kotlin, you get more with less code.
NB: We can migrate your Android apps from Java to Kotlin - no sweat!
Apps We’ve Built With Kotlin
Pieoneers is currently working on a mobile app for RST Instruments in Kotlin. The app will replace their existing pocket PC with an upgraded user interface offering improved user experiences through the use of mobile phones. Stay tuned for more exciting projects we're working on in Kotlin - currently under wraps with NDAs!
Which Platform is Best for your App?
The answer is obvious - Kotlin is the ONLY choice today to build your Android app!
Kotlin, with its superior productivity and outstanding Android Studio support, is the future of Android app development!