Tuesday, 10 July, 2018 UTC


Summary

 
Kotlin continues to gain momentum among Android developers. In case you’re not familiar with Kotlin, it’s a statically typed, JVM-based language that’s interoperable with Java.  It was developed by IntelliJ IDE provider Jetbrains, which introduced the language in 2011. Version 1.0, the first officially stable release was introduced in February 2016.
However, Kotlin’s status was instantly elevated when Google deemed it a first-class citizen in the Android IDE at the May 2017 Google I/O event.  By late 2017, software quality company TIOBE made waves and headlines when it predicted that Kotlin would replace Java for Android app development.
Hype aside, following are a few facts.
Kotlin by the Numbers
Mobile app development tool and platform provider Realm produces a report that covers trends and activity patterns gleaned from its global community of active mobile application developers.  Its initial Realm Report, published in Q4 2017, showed that Kotlin adoption grew from 0 percent prior to its v1.0 launch and to 4.28 percent by the May 2017 Google announcement. By September 2017, Kotlin use had increased to 7.54 percent while Java slipped from 50.66  percent to 46.23 percent in the same time frame.
Software development industry research firm Redmonk also reported aggressive Kotlin growth.  In Q3 2017, Kotlin ascended from #65 to #46 on Redmonk’s list of top 100 languages. By January 2018, Kotlin had jumped to #27, making it the fastest-growing language behind Swift. To make Redmonk’s list at all, a language must be observable on both Github and StackOverflow.
Meanwhile, TIOBE’s June 2018 Top 100 most popular programming languages list ranked Kotlin at #49 based on an analysis of search engine results.
“Usually programming language adoption is a slow process, but Kotlin’s usage is [growing] fairly fast” among TIOBE’s multinational customer base, Paul Jansen, managing director at TIOBE, said, though he was unable to provide data showing the actual adoption rate.
TThere is also the Popularity of Programming Languages (PYPL), based on Google searches for tutorials.  That list ranked Kotlin #16 on a list of 22 for June 2018. Java ranked #2. Interestingly, between June 2017 and June 2018, Kotlin foothold increased by 0.6 percent while Java fell by the same amount.  Specifically, the list shows that Kotlin had 0.93 percent market share in June 2018 compared to Java at 22.45 percent.
Most recently, communications and collaboration API provider Pusher announced the results of a survey of 2,744 developers, 60 percent of whom use Kotlin for work and personal projects.
All indications are that Kotlin is gaining ground at Java’s expense.  Still, Gartner Research VP Mark Driver said there are remarkably few Kotlin developers.
“It’s of interest, it’s growing, but there are far fewer Kotlin developers than the noise would warrant,” said Driver.  “The whole idea it’s going to replace Java is overhyped. We don’t see Kotlin stacks, we don’t see things that are unique to Kotlin above a certain radar threshold.”
Part of the problem is fragmentation.  There are more languages competing for market share today than there were historically.
“Open source markets are typically flat,” said Driver “Kotlin only needs a couple hundred thousand developers to make it successful.  It probably has that or more today. One can assume every line of code written in Kotlin is a line of Java that isn’t being written or at least a good chunk of it is.  Is it replacing Java in the big picture? Of course not.”
What’s to Like About Kotlin
Android Studio support makes for a more stable developer experience.  It also helps that Android Studio is based on JetBrains’ IntelliJ, giving Kotlin a unique advantage over other languages.  And since Android Studio ships with Kotlin, starting a Kotlin project is point-and-click simple – no need for a plugin as before. In addition, debugging Kotlin code is the same as debugging Java code.
“A lot of Android developers aren’t necessarily Java developers, so they’re not pre-disposed to demand Java,” said Gartner’s Driver. “Their last language was probably Objective-C or Swift because they were building an iOS app and now they’re being asked to develop an Android app.”
The Android Studio support also gave software development managers greater confidence about the language because they no longer had to worry about the language’s longevity.
“Anytime you ship a language with an IDE, it’s more likely to be discovered,” said Driver.  “There’s a stamp of approval on it out of the box.”
Kotlin is interoperable with Java, so shops can migrate at their own pace instead of rewriting entire applications.  The interoperability enables Kotlin code to be converted into Java code and vice versa. It’s also possible to combine Kotlin and Java code within the same application. However, before doing a conversion, developers are wise to read the short interoperability guide because it will save time in the long run.
“There’s no risk of incompatibility because it’s running on the JVM,” said Driver. “[However,] if you’re not a Java developer, you’re probably not looking at Kotlin.”
Kotlin application performance is comparable to a Java application performance, although Kotlin builds can take more or less time than Java builds, depending on the type of build that’s executed.  For example, a clean Kotlin build may take longer than a clean Java build, while an incremental Kotlin build may actually be faster. The differences in build times aren’t substantial enough to impact Kotlin use, though.
Developers also like Kotlin’s concise syntax because it reduces the possibility of errors.
“Significantly simplified syntax avoids a lot of scaffolding that you have to go through with Java to do casting,” said Gartner’s Driver. “You can accomplish many of the same things with fewer lines of code, so you’re less likely to introduce bugs and therefore it’s more likely to reduce the cost of maintaining the code, but there’s nothing industry-changing about it at all.  It’s just small improvements and streamlined factors here and there. It’s similar to what Apple did with Swift.”
Kotlin’s null safety is also attractive, especially given the angst null causes Java developers.  For example, software analytics company OverOps discovered that out of one billion Java logged errors, 97 percent of errors were caused by 10 unique errors, the most common of which were NullPointerException errors.  A later study of 1,000 applications confirmed that finding, showing that such errors impacted 70 percent of production environments.
Kotlin’s strong tooling is also an incentive.  Unlike other languages, Kotlin was developed by an IDE provider who concurrently built Kotlin and first-class IDE support of Kotlin.
“IntelliJ is an incredibly popular IDE,” said Driver.  ”I think JetBrains saw the cumbersome relationship between Java and some of the IDEs and said we can build a language that’s a little more streamlined and modernize it.  Java was built 25 years ago. If you built it today, you’d end up with something like Kotlin, taking advantage of what we’ve learned in the last 25 years.”
What’s New
At the 2018 Google I/O event, Google announced Android Jetpack, which is the latest generation of Android components. Jetpack provides backward compatibility and immediate updates to a larger set of components so developers can build higher-quality apps faster and cheaper. It also manages background tasks, navigation and lifecycle management.
Included in Android Jetpack is Android KTX, which are Kotlin-specific components designed to improve the developer experience. Components include WorkManager, Paging, Navigation, and Slices.
Google also improved the performance of the Android Runtime (ART) so Kotlin apps can run faster.  Code snippets have been added to the official documentation and Google published a Kotlin version of the API reference documentation. The company also launched a Kotlin Bootcamp on Udacity and it now has a Kotlin specialization in the Google Developers Expert Program.
Meanwhile, the language itself has been evolving. Kotlin 1.2, the last major release, enables code reuse between the JVM and JavaScript so developers can write an app’s business logic once and reuse it across the back end, browser front end and Android mobile apps. v1.2 also compiles 25 percent faster than v1.1. Kotlin 1.1 included a JavaScript target that allows developers to compile Kotlin code into Javascript that runs in a browser. Minor releases included support for Gradle build cache (v1.2.2), a number of bug fixes, JUnit 5 support and more.
Kotlin Native also continues to mature. It was announced in November 2017 and is now at v. 0.7.  It compiles Kotlin into machine code and produces executables that don’t require a virtual machine.
The post Kotlin gains ground in Android, but no current threat to Java, experts say appeared first on SD Times.