On 17 May 2017, Google announced their first-class support for Kotlin, which means that Kotlin became an official language for Android app development. Since then, JetBrains proved that Kotlin can also be successfully used for writing iOS apps – the official app of KotlinConf 2017 was built entirely in Kotlin and supported iOS, Android as well as most browsers via its web app. With the growing support for both major mobile platforms Kotlin is bound to gain in popularity, and its future seems not to be confined only to Android. You might have heard about Kotlin and asked what it is and whether it is worth choosing this technology over Java for Android mobile development. This article was written to provide answers to these questions - and more.
Kotlin is a modern programming language for Android, JVM, Browser, and Native development created by JetBrains. It has the official support of Google, but the Android community has been using the language for app development for years even before the support announcement. Recently, it has received improved support for iOS. We’ve been using Kotlin since 2015 when it was still in beta – have a look at our Kotlin showcase app, CoolCal, and a brief article about how it was developed. Kotlin’s website gives a number of examples of well-known products written in the language, such as Pinterest, Evernote, and Trello.
Kotlin is a powerful, modern language with many useful features. It’s very expressive and much more concise than Java. While Java has earned its reputation as a robust and reliable technology, it lacks many features and is slowly becoming obsolete, making Kotlin a great candidate to replace it. Kotlin is very similar to Apple’s Swift in terms of its ideas and goals. The similarities between these two languages will help Android and iOS developers easily switch between development for each platform.
When it comes to strictly technological advantages, Kotlin offers first-class support for functional programming, even though it is mainly object-oriented, making the most out of both paradigms and opening new programming possibilities. Apart from that, JetBrains built protections against errors related to nulls straight into the type system, which makes the language much more fault-proof and thus easier and cheaper to maintain. The creator of null famously said that the null reference must have generated billions of dollars in losses caused by errors, vulnerabilities, and system crashes. Now, you can stop fearing null-related errors and save yourself some money, too.
If you’re currently using Java to develop your Android app, fear not, because nothing will change. Google will continue to provide great tools and resources to make Java app development easier and faster. You can also add Kotlin to your app without worrying about future support. Check out Google’s official guide on how to get started with Kotlin development for Android.
You don’t need to put all your eggs in one basket and pick one or the other. Since Kotlin is 100-percent interoperable with Java, you can incorporate it seamlessly into your existing app, and you won’t even need to rewrite any Java code – just start coding in Kotlin right away!
That said, we would still recommend converting the app to Kotlin for a number of reasons. Being more fault-proof, the app will become easier and cheaper to maintain. Kotlin also facilitates faster development because it is much more concise – rough estimates show that it can cut as much as 40% lines of code compared to Java. Fewer lines of code = less time spent on coding = less money spent on development. Oh, and there’s an automatic Kotlin-to-Java converter, too, which you can find here.
Most importantly, an app written in Kotlin will be cheaper and easier to develop and maintain – the language will make the codebase more concise and fault-proof, which, in turn, translates into significant savings. Kotlin is also becoming more and more universal, so you will be able to transfer your app from one platform to another if need be. Lastly, the framework is new, efficient, and exciting, which will attract good developers. We’ve already noticed this at Netguru – we’ve been getting lots of really interesting CVs from developers interested in programming in Kotlin.
Thanks for reading! If you have any comments or would like to ask a question about Kotlin, drop us a line!