Kotlin arrival: the official start of a post-Java era

Kotlin arrival: the official start of a post-Java era

There is an island in the South-East Pacific, which is quite big and very picturesque. The island is famous for two main aspects: the first socio-demographic one represents the most populous island on Earth (over 141 million of Indonesians choose the island as their abode). Another aspect makes the island’s name very significant for programmers throughout the world. We are talking about Java, of course.

There is another island, however. It is quite small and lies far from Java in the Gulf of Finland (Baltic Sea). Its demographics is far more modest in comparison with Java (about 43 000 people live there). From the mere traveling point of view, the island is popular only among tourists who visit Saint Petersburg city (Russia) to which the island belongs to a district.

Despite the seemingly humble social significance of the island, its name is gaining popularity among programmers at a fast pace. The name of the island is Kotlin.
 

Two islands - two languages

The comparison of the population of both islands is reasonable also with regard to the number of users of Java and Kotlin languages. The mature and popular Java traditionally takes top lines of programming language indexes (Tiobe and the like) while Kotlin pulls up the rear being out of even the top 50.

kotlin android development company.png

The proportion of users of both languages is almost equal to the difference between the demographics of both islands. It would be unduly to compare Java and Kotlin languages at all unless the Godzilla of the contemporary IT industry has announced the first-class support of Kotlin recently.
 

When origin matters

Although Java is well known as a default language of Android development, Google included Kotlin into Android Studio 3.0 out of the box. We suppose everybody understands that such decisions can hardly be made at the drop of a hat. Besides, quite possible rapid elevation of Kotlin on the top of popularity among developers due to Google’s support can lead to far-reaching effects for many software vendors all over the world.

Up to this moment only Kotlin’s creators - JetBrains company having R&D in Saint Petersburg and offices in Munich, Prague, Moscow, Boston, and Novosibirsk actively promoted the language while using it for their platforms (Kotlin/JVM for server and desktop, Kotlin/JS and Kotlin/Native). By the way, in addition to Google’s acknowledgment, just the origin of the language can make many developers who are looking for alternatives to Java turn their eyes toward Kotlin.

Custom tooling makes sense

Often professionals are not satisfied with tools available in common use. In such a case, they modify and improve a tool in accordance with their own sense of perfection. JetBrains is a reputable Java professional whose idea about a perfect programming language is realized with Kotlin.

kotlin in use.png

They used Kotlin in building their award-winning IntelliJ IDEA, ReSharper, Project Rider and other great developer tools. JetBrains is too experienced to try creating a new programming language from scratch. Any language without a community and an ecosystem are dead from birth. The guys from Saint Petersburg bet on one of the most popular programming languages creating Kotlin as an evolutionary step of Java.
 

Too many people - too many minds

Such an approach is very pragmatic reflecting the clear vision of the state of affairs in the global software development. Andrey Breslav, Kotlin team lead, confirms the approach saying, “If I were to choose one word to describe Kotlin’s design, it would be pragmatism. For us it means caring about the usefulness… It’s about creating a user experience, not a language or a library alone."

However, Kotlin is not the first attempt to invent a better version of Java. And the developers’ community responds accordingly comparing Kotlin with Scala oftentimes. The synthesis idea of skeptics is expressed by the following quote from visitors’ comments on Kotlin website:

“Java is, was and will be fine language. I don’t understand why to use Kotlin.
It’s just art for art, just another ‘thing’ that bored developers could use to be not so bored…”

 

Bigwigs’ opinion bans ignoring

Nonetheless, the influence of the authorities such as Citibank, Tesla, NASA, Samsung, Twitter, Cisco, and Siemens who are using JetBrains products incentivizes considering Kotlin worthwhile. Besides, professional developers who have already implemented Kotlin into their practice represented enough reasoned arguments of why Kotlin could be more efficient than Java for software development. Dan Lew (Trello Android, Atlassian) summarizes Kotlin’s advantages over Java in his blog:

“Kotlin has both object-oriented and functional constructs. You can use it in both OO and FP styles, or mix elements of the two. With first-class support for features such as higher-order functions, function types and lambdas, Kotlin is a great choice if you’re doing or exploring functional programming… Kotlin is more concise.

Rough estimates indicate approximately a 40% cut in the number of lines of code. It’s also more type-safe, e.g. support for non-nullable types makes applications less prone to NPE’s. Other features including smart casting, higher-order functions, extension functions and lambdas with receivers provide the ability to write expressive code as well as facilitating the creation of DSL.”
 

Concise code makes life easier

The verbosity of programming languages is the stuff of legend among developers who are always looking for better programming productivity. It seems JetBrains can grasp the trend maintaining a good balance between verbosity and brevity.

kotlin android developer.png

Kotlin stands far from the super terse J or R languages offering much briefer code than prolix COBOL does meanwhile. Another comment from Kotlin’s blog represents a demonstrative example of how Kotlin can add more power per line of code directing a jab at Scala’s chin at a time:

“Scala is a kind of art for art. Kotlin is pragmatic and brings you saving-time features, it combines fun and utility…A simple example that I showed to a colleague of mines yesterday:

#Kotlin: executions.groupBy { it.price }.size > 1
#Java: executions.stream().collect(Collectors.groupingBy(it -> it.getPrice(), Collectors.counting())).size() > 1

Which one do you prefer?...”
 

Genesis is not handicap  

The full interoperability with Java (Kotlin runs on Java Virtual Machine, by the way) makes Kotlin easy to get started offering a low entry barrier for those developers who are currently tied to Java projects. It means a seamless and smooth migration from Java to Kotlin that can be continuously performed in a project-by-project mode. Needless to say that such an opportunity can make Kotlin more attractive for many programmers hesitating with regard to the appropriate alternatives to Java. Although some call Kotlin “Swift for Android”, JetBrains does not want to be acquired by Google or by anybody else while keeping Kotlin free and open source under Apache 2. Despite representing Kotlin as a uniform tool capable of bridging different platforms JetBrains admits that their language relates to Java even closer than C++ does to C. Kotlin plugin is available for download with Android Studio 3.0 now. JetBrains invites everybody to try Kotlin beforehand through the online exercises (koans) available on the Kotlin website.

What few people know is that in the 1930s a secret biochemical laboratory was established on Kotlin island. Soviet military scientists conducted experiments with different viruses and infections there. So, using this fact as a metaphor, Indeema concludes the present review wishing JetBrains to keep their young language both viral like cholera and deadly effective like plague (in a good sense, of course :)

005.png

Tags: KotlinJavaAndroidProgramming languageMobile Development

Subscribe to start receiving notifications about new posts

and monitoring social networks

<?xml version="1.0" encoding="utf-8"?>