During its I/O event on May 17, Google announced that Kotlin joins Java and C++ and is now Android’s third official language. This was big news for mobile app development, and the online sample code editor on Kotlin’s official website was lagging for hours due to the overload of visitors.
While hundreds of thousands of developers wanted to figure out what exactly Kotlin was all about, many had heard of this statically-typed programming JVM language before. Developed by JetBrains in 2011, Kotlin was supposed to compensate for Java’s syntactic weaknesses and boost development of mobile apps.
Did the language succeed? Its production use by Amazon Web Services, Pinterest, Coursera, Trello, Netflix and other big companies, as well as partnership with Google all hint at a ‘yes’. Still, let’s look into more details to find the answer.
With care for developers
Kotlin is completely interoperable with Java and can be used as its mere syntactic extension. Yet when comparing the two languages, developers underline that Kotlin isn’t just more functional and flexible, but also very comprehensible. All of its commands are clear and to the point; none needs to be explained with some ‘compilation wonders’ typical for Java and many other languages.
What’s more, Kotlin already has a reputation of being a pleasure to work with: Google goes as far as calling it “delightful” in their latest address regarding the partnership. This admiration of the code's elegancy and recognition of care for developers’ working processes is exactly what you’d expect from Google and their policy.
Cutting the code in half
Kotlin fans share the same vision of Java: it’s functional and efficient, but pays too much tribute to the past. Many say that Java could have become greater than it is now long ago if only it casted off some of its code legacy. While inheriting a lot from Java, Kotlin does just that.
As a result, developers are asked to write less code in Kotlin and then have it either automatically translated into Java with 100% accuracy or compiled. The reduction size varies case by case, but overall it’s quite impressive, with some chunks cut down from 16 lines to only 8.
Adding up more functions
Default arguments, which are completely absent in Java, is what helps to reduce Kotlin’s code amount and makes it as transparent as it is. Besides that, Kotlin offers lambda expressions, higher-order functions and operator overloading. Also, the code has the minimum runtime among all JVM languages – only 700 kilobytes – which is an important advantage for large-scale Android mobile development projects.
Another major feature introduced in Kotlin is null-safety that eliminates null-references. Instead of making the app crash during the final code execution (as it happens in Java), Kotlin will notify developers about null references prior to compilation.
Like any programming language or even more so, Kotlin aims at becoming a convenient development medium for engineers. With its improved syntactic nature and extended functionality, the language allows simpler and more enjoyable coding. ScienceSoft’s Android developers have been keen on Kotlin for some time already and greatly cherish its convenience.
Convenience aside, there are financial benefits for businesses too. The need to write less code for Android apps will help vendors to hire fewer development resources. At the same time, the projects will be delivered faster, which means less costs of app development and maintenance to the advantage of business clients.
Dealing with a mobile-related challenge? Take advantage of the diverse and deep knowledge of our mobile development team.