Kotlin - Another Java Alternative?
Written by Alex Armstrong   
Monday, 25 July 2011

Kotlin is the latest programming language that runs on the Java Virtual Machine. Do we really need another Java?

JetBrains has announced a new alternative to Java. Kotlin takes its name from an island in the Gulf of Finland near to Saint Petersburg, Russia, where one of the main JetBrains' development offices is located.

It is object-based, statically typed, and compatible with the Java virtual machine and other languages that run on it, including of course, Java itself. Kotlin's compiler can output Java byte code and Java can call Kotlin code and vice versa. None of this is surprising as JVM languages are generally easy to make work together. More puzzling is that statement that JetBrains is also looking into combining Kotlin with JavaScript.

 

 

 

As a language the design is not remarkable. It has all of the usual features - objects, closures, extension methods and mix-ins. The language seems to have been produced because of the general dissatisfaction with Java and Java alternatives such as Scala, Groovy and Gosu. Specifically:

  • Scala is too complex and it's very hard to make a good tooling support for it
  • Groovy is dynamic, i.e. error-prone on big codebases, and slow
  • Gosu is statically typed, but treats all generics as covariant, i.e. makes the same mistake Java made with arrays, besides, it is primarily a scripting language
  • Ceylon is Java-incompatible, because it does not support overloading

It also seems to have picked many of its features from each of the languages and possibly a touch of C# thrown in. The stated design goals are

  • to make a safer Java compatible language i.e. by checking for common errors such as null pointer use
  • to make it more concise than Java  for example by using type inference.
  • to make it simpler than existing Java alternatives such as Scala.

Given that that language doesn't express a single big idea the question of its success probably depends on how all of the features fit together - or not. After all the world hardly needs yet another programming language let alone another JVM-based language. A quick look at the syntax description reveals a very nice modern language but for a language to become popular and hence viable it needs something more. Sometimes it is just a matter of being there at the right time - like Java itself - or it's a matter of an "authority" encouraging you to use it - like C#.

A Beta is planned for later this year and once this is available JetBrains plans to offer the compiler and plug-in for IntelliJ IDEA, its Java development environment, under the Apache licence as open source software.

More information

Kotlin documentation

A Kotlin  "Hello, world!" site

Related articles

Ceylon - a new Java killer?

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Use Javascriptmas To Hone Your Webdev Skills
08/12/2024

Every day until December 24th MDN, in partnership with Scrimba, is releasing a daily challenge, which as the name suggests requires you to practice your JavaScript skills. Each solution you submi [ ... ]



Visual Studio 17.12 Released Along With Aspire
25/11/2024

Visual Studio 2022 v17.12 is now available. The release can be used for .NET 9 projects and has a range of other improvements.


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

<ASIN:1871962706>

<ASIN:1871962544>

Last Updated ( Monday, 20 November 2023 )