14 comments

[ 3.6 ms ] story [ 22.8 ms ] thread
Anyone using Kotlin for production code, how mature is it, re. tools and language?

How is it compared to Java 8/9?

Eclipse vs IntelliJ?

Since the Kotlin and IntelliJ are created by the same company, I suspect that support in IntelliJ must be somehow better :)
Actually it's still lagging behind slightly (there's a big of jankyness at some points, e.g. when moving classes). But it'll get there.
I have not used it for production code, I just toy with the language.

I work in a 15 engineers Android team with a very conservative lead, even as a senior engineer, there is no way to introduce Kotlin.

The tooling is pretty great, Jetbrains knows how to develop an IDE and it shows.

Compile time is a bit slower.

The language is way better than Java 8 IMO. It aims at solving all the weaknesses of the language and does a good job at that.

Also, support for scripting from command line!

See end of page here: https://kotlinlang.org/docs/tutorials/command-line.html

This could be awesome as it opens up for a better alternative than Groovy for tooling.

Also, scripting might be a way to sneak in a new language in a conservative developer organization? Start using it for tooling, builds, testing, etc ...

The backers of Apache Groovy also tried the trick of sneaking in a new JVM language by offering tooling, testing, etc. But Groovy only had the dynamic language available, so there was nothing else there if people wanted to use it to build systems. They then opened up their AST via annotations to encourage people to build addons. Then after someone did build an addon (i.e. Groovy++) for static compilation, the Groovy backers built their own edition and bundled it in Groovy 2, thus killing all developer trust in the 3rd-party AST addon market. Unfortunately, the Groovy static compilation was built by only one developer and it still has QA issues. And it came too late -- many businesses still just host Groovy 1.x for legacy scripts.

Kotlin, on the other hand, built the static compilation and Android targeting first, as the primary feature, and is offering the Repl and toplevel statements as extras. This is how languages are meant to work.

It is also very interesting to see them partner with gradle.

That way they get a foothold in the android world (since most android apps are built with this build system) and it will be interesting to be directly able to compare kotlin & groovy scripts.

I've used in a production android app that was initially java only and we introduced kotlin before the language was 1.0. Language was a bit unstable back then and it was getting updated often but since 1.0 it's been stable.

Definitely makes android development more pleasant as you have more tools and language features. It feels like a modern typesafe language.

The things I like the most is that you can mix and match the 2 language with little effort and that JetBrains has done an amazing work integrating the language in the IDE (Android Studio) which is based on the IntelliJ platform.

Our team was comprised of polyglot devs (java/obj-c/swift) so kotlin felt more like swift in some ways so working both on ios and android made it pleasant and porting was easier.

I wouldn't recommend you convert your java project to 100% kotlin to start but the excellent interop (better than obj-c/swift) between java-kotlin makes it easy to try some stuff out and see if you like it. They have a very helpful slack channel where all the kotlin devs and language designers hang out so they are always responsive to questions. The community is still small but very helpful and the folk are nice and inclusive.

So to answer you question it is ready for production and tools are excellent as well as the language is very pragmatic and has evolved pre-1.0 based on real life developer feedback not from academics who are not coding every day.

We are using Kotlin in production for two projects. One is a spring boot backend for an online banking app for a large european bank. The other is an Android app for an NGO that gives out microloans to farmers who would not get a loan from a bank.

I find Kotlin a low-risk alternative to Java. Your code still feels like a normal Java project: You use the same frameworks, you have excellent tool support, you can keep searching for java questions on stackoverflow. Kotlin is fast and fully compatible with your Java code.

We are hiring at the moment, and our offer asks for an experienced Java/Spring developer. We just mention Kotlin at the end of the description.

Kotlin is not the right tool if you "hate" Java. It feels like the language that the Java 8 team would have built if backwards compatibility was not an issue.

Apart from some very useful syntactic sugar, it has

  - no checked exceptions
  - classes and methods are by default final
  - no primitives that need to be (auto)boxed to and from objects
  - no "static" context
  - first class functions
  - named function arguments that can have defaults
  - null safety
  - less broken generics
I like Java as a platform, and I think the language is perfectly fine. But Kotlin offers a cleanup and improvement, at almost no cost.
I was a Java developer like 5 years ago, and already forgot everything about it. Do I have to relearn Java in order to learn Kotlin?
As Kotlin is more or less Java with some sugar thrown on top, yes. Even if you "learn Kotlin" on its own, you'll essentially have re-learned Java.
Thanks, so it is not the kind of language I can learn the basic for fun in a weekend.
Depends on what you mean by "learning a lanuage".

You can probably learn the syntax, and to build and run your application in a couple of days. Learning the "ecosystem" of Java I think is another matter.

Installing the Eclipse-plugin which includes the Kotlin compiler, creating and running a "hello World" takes only a few minutes (I just did that).

It depends, what is your background?

Java is a run-the-mill object oriented language. If you've used any OO language with dynamic dispatch, you're immediately set 90% of the way to fluency.

The tricky part is the generic part of the type system, the part with the `? extends` and `? super` annotations.