I am a software engineer at Google on the Android project and the creator of the Java testing framework TestNG. When I'm not updating this weblog with various software-related posts or speaking at conferences, I am busy snowboarding, playing squash, tennis, golf or volleyball or scuba diving. Cedric is a DZone MVB and is not an employee of DZone and has posted 89 posts at DZone. You can read more from them at their website. View Full User Profile

Five reasons why you should rejoice about Kotlin

07.21.2011
| 5271 views |
  • submit to reddit

As you probably saw by now, JetBrains just announced that they are working on a brand new statically typed JVM language called Kotlin. I am planning to write a post to evaluate how Kotlin compares to the other existing languages, but first, I’d like to take a slightly different angle and try to answer a question I have already seen asked several times: what’s the point?

We already have quite a few JVM languages, do we need any more?

Here are a few reasons that come to mind.

1) Coolness

New languages are exciting! They really are. I’m always looking forward to learning new languages. The more foreign they are, the more curious I am, but the languages I really look forward to discovering are the ones that are close to what I already know but not identical, just to find out what they did differently that I didn’t think of.

Allow me to make a small digression in order to clarify my point.

 

Some time ago, I started learning Japanese and it turned out to be the hardest and, more importantly, the most foreign natural language I ever studied. Everything is different from what I’m used to in Japanese. It’s not just that the grammar, the syntax and the alphabets are odd, it’s that they came up with things that I didn’t even think would make any sense. For example, in English (and many other languages), numbers are pretty straightforward and unique: one bag, two cars, three tickets, etc… Now, did it ever occur to you that a language could allow several words to mean “one”, and “two”, and “three”, etc…? And that these words are actually not arbitrary, their usage follows some very specific rules.

What could these rules be? Well, in Japanese, what governs the word that you pick is… the shape of the object that you are counting. That’s right, you will use a different way to count if the object is long, flat, a liquid or a building. Mind-boggling, isn’t it?

Here is another quick example: in Russian, each verb exists in two different forms, which I’ll call A and B to simplify. Russian doesn’t have a future tense, so when you want to speak at the present tense, you’ll conjugate verb A in the present, and when you want the future, you will use the B form… in the present tense. It’s not just that you need to learn two verbs per verb, you also need to know which one is which if you want to get your tenses right. Oh and these forms also have different meanings when you conjugate them in past tenses.

 

End of digression.

The reason why I am mentioning this is because this kind of construct bends your mind, and this goes for natural languages as much as programming languages. It’s tremendously exciting to read new syntaxes this way. For that reason alone, the arrival of new languages should be applauded and welcome.

Kotlin comes with a few interesting syntactic innovations of its own, which I’ll try to cover in a separate post, but for now, I’d like to come back to my original point, which was to give you reasons why you should be excited about Kotlin, so let’s keep going down the list.

2) IDE support

None of the existing JVM languages (Groovy, Scala, Fantom, Gosu, Ceylon) have really focused much on the tooling aspect. IDE plug-ins exist for each of them, all with varying quality, but they are all an afterthought, and they suffer from this oversight. The plug-ins are very slow to mature, they have to keep up with the internals of a compiler that’s always evolving and which, very often, doesn’t have much regards for the tools built on top of it. It’s a painful and frustrating process for tool creators and tool users alike.

With Kotlin, we have good reasons to think that the IDE support will be top notch. JetBrains is basically announcing that they are building the compiler and the IDEA support in lockstep, which is a great way to guarantee that the language will work tremendously well inside IDEA, but also that other tools should integrate nicely with it as well (I’m rooting for a speedy Eclipse plug-in, obviously).

3) Reified generics

This is a pretty big deal. Not so much for the functionality (I’ll get back to this in the next paragraph) but because this is probably the very first time that we see a JVM language with true support for reified generics. This innovation needs to be saluted.

Correction from the comments: Gosu has reified generics

Having said that, I don’t feel extremely excited by this feature because overall, I think that reified generics come at too high a price. I’ll try to dedicate a full blog post to this topic alone, because it deserves a more thorough treatment.

4) Commercial support

JetBrains has a very clear financial interest in seeing Kotlin succeed. It’s not just that they are a commercial entity that can put money behind the development of the language, it’s also that the success of the language would most likely mean that they will sell more IDEA licenses, and this can also turn into an additional revenue stream derived from whatever other tools they might come up with that would be part of the Kotlin ecosystem.

This kind of commercial support for a language was completely unheard of in the JVM world for fifteen years, and suddenly, we have two instances of it (Typesafe and now JetBrains). This is a good sign for the JVM community.

5) Still no Java successors

Finally, the simple truth is that we still haven’t found any credible Java successor.

Java still reigns supreme and is showing no sign of giving away any mindshare. Pulling numbers out of thin air, I would say that out of all the code currently running on the JVM today, maybe 94% of it is in Java, 3% is in Groovy and 1% is in Scala. This 94% figure needs to go down, but so far, no language has stepped up to whittle it down significantly.

What will it take? Obviously, nothing that the current candidates are offering (closures, modularity, functional features, more concise syntax, etc…) has been enough to move that needle. Something is still missing.

Could the missing piece be “stellar IDE support” or “reified generics”? We don’t know yet because no contender offers any of these features, but Kotlin will, so we will soon know. Either way, I am predicting that we will keep seeing new JVM languages pop up at a regular pace until one finally claims the prize. And this should be cause for rejoicing for everyone interested in the JVM ecosystem.

So let’s cheer for Kotlin and wish JetBrains the best of luck with their endeavor. I can’t wait to see what will come out of this.

Oh, and secretly, I am rooting for Eclipse to start working on their own JVM language too, obviously.

 

From http://beust.com/weblog/2011/07/20/five-reasons-why-should-rejoice-about-kotlin/

Published at DZone with permission of Cedric Beust, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Artur Biesiadowski replied on Fri, 2011/07/22 - 4:30am

I will expect very poor IDE support outside of IDEA. Kotlin basically seems to be marketing ploy to sell more IDEA licenses, so I really doubt that JetBrains will invest time in creating Eclipse/Netbeans plugins. As for other parties, given how much time it took to get reasonable support for popular languages like Groovy and Scala, I don't really see it happening that fast for Kotlin...

John J. Franey replied on Fri, 2011/07/22 - 8:09am

Lets look ahead to a time when each IDE has their own JVM based language. I don't think I could advocate such a future:

1) The division between the IDE users would grow deeper. The division would be compounded by the battles over which language features are favored. So much for 'separation of concerns'.

2) Projects would be locked into an IDE. Java doesn't require my team to use IDE-X. Our projects, theoretically, could be imported into any IDE that can import or use a maven pom as its build descriptor. In the future above, the decision to use a particular language at all would be narrowed by the IDE favored by the current team. And much later, change to the project's implementation language would require a change in the IDE, too.

3) And if the same corporate entity sees a value in using all unique IDE languages, maybe even within the same project effort? It won't be enough for developers to know each language, but also would need expertise in each IDE. A developer would have to switch IDEs to work on different sub-projects maybe to complete a single task. The developer would have more than one IDE installed, maybe on a single developer's machine.

4) The languages would restrict employment mobility and the labor pool will seem smaller to hiring managers. HR would scan resumes for IDE-X language developers, by-passing experienced IDE-Y users, presenting a smaller group of candidates to hiring managers.

Dmitri Bichko replied on Fri, 2011/07/22 - 10:07am

You know what language will step up as the "Java successor"?

Java 8.

For the simple reason that it has 80% of the features people actually want and doesn't bring in a ton of baggage for the sake of cramming in every feature under the sun.

Peter Bliznak replied on Sat, 2011/07/23 - 3:28pm

Nice article, I have to say, but even though I share your enthusiasm for learning/exploring new languages I do not see (yet) anything special in this one. I have run through its features and if I compare it to say Scala then it is not only not better but it is lacking numerous features (ie parallel collections ... ). They have comparison matrix on their site; you can go there and check for yourself. Aside from that I do like that new languages are popping out here and there and perhaps they will get better in the future. Having said that, I think it is not the one that is going to dethrone Java now or in the near future - not a chance, and as someone mentioned above already Java 8 will be truly "new" Java.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.