Improving Kotlin - A couple of thoughts


#1

Hi,

I have been playing with Kotlin for a while now. It’s a really nice language that improves on areas that Java needs improving on. I just wanted to share my thoughts here:

Tooling
I know that JetBrains is not an Eclipse company. But limiting your toolchain to IntelliJ will make it really difficult to gain traction. Most of my projects are Eclipse only. I’m just tolerated as an IntelliJ user. It would be very hard to suggest to these shops to try out Kotlin. I’m cool with that. Go ahead, make the IDEA plugin as perfect as possible. For the rest of the developers, I’m not so sure if that’s the best path to go down, though.

Maybe you should make a Kotlin IDE for new users to get started with. This would be an IntelliJ Community Edition with a pre-packaged Kotlin plugin and a template in the new project wizard to get you started. Another idea would be to make the Angular JS workflow work out of the box with that IDE to show of the JVM/Javascript integration. The focus could be to get you started developing Angular-JS in Kotlin by just downloading the Kotlin IDE and creating a new project through the New Project wizard. With navigation between Kotlin Code and Angular-JS as shown in the video. You could expand on this with a couple of blog posts giving more background to make the topic more accessible to novice users and with advanced topics like adding a server component as well (and sharing Kotlin code on the client and server side).

Documentation
That’s an area that I haven’t been happy with. Just to name a few things:

  • Visibilities: which visibilities are there in Kotlin and what do they mean? There are differences improvements over Java but that’s something the documentation should go into!
  • main: You need to have an entry point to run your code. In Java you’d start out writing a couple of classes, each with a main method. It doesn’t work that way in Kotlin, because of the visibility of the main function. As a new user that just wants to play with a couple of things you’re stuck at that point. Also: the Getting started part of the documentation really isn’t about getting started but more about downloading plugins. Pointing to IDEA 13 EAP build configurations really is so yesterday…
  • Collections: There really isn’t much you can do without lists, maps, and so on. The documentation only seems to mention arrays. How Do I create lists? Is there anything special about them in Kotlin? Even: how do I need to declare a list variable and assign values to it? Of course, there’s an answer for that, but not in the documentation.
  • Comparison with Java: How does Kotlin compare with Java, especially with Java 8? For example: Java 8 has some limitiations with closures (can only access variables that are considered final, Exceptions – UncheckedIOException). I think there should be a comparison between the new Java 8 features and their equivalent in Kotlin (closures vs. function literals, method references, it, …). How does Kotlin deal with SAM, default methods in interfaces, static methods in interfaces? Anything special about the streams API (e.g. Kotlin has zip, Java 8 hasn’t). Java 8 currently is a hot topic and I believe these questions should be answered by the documentation. Is Kotlin redundant, now that Java 8 is available? I believe no, but the documentation should make a strong point about that fact (and explain why)!

I really enjoyed reading through the Ceylon documentation. It’s pleasant to read and has plenty of examples that help you understand the design concepts. I believe that the Kotlin language deserves something similar. I know that this is hard, especially when resources are limited. But if this evil world tells uns one thing, it probably is that you should always present yourself in the brightest light as perfect as possible…

#2

Thanks for your feedback


#3

> I know that JetBrains is not an Eclipse company. But limiting your toolchain to IntelliJ will make it really difficult to gain traction

Big +1 here. I am considering introducing Kotlin at my work place but it’s a non starter if it can only be used with IDEA. About half of the team uses Eclipse and selling a team on a new language is already a big undertaking, but telling them that on top of that, they need to switch IDE’s is a deal breaker.


#4

We are working on an Eclipse plugin:

GitHub repo: https://github.com/JetBrains/kotlin-eclipse
TeamCity CI page (with downloadable artifacts): http://teamcity.jetbrains.com/viewType.html?buildTypeId=Kotlin_EclipsePlugin (login as guest)


#5

Awesome, thanks Andrey.