Jun 12, 2012 10:37 PM

I'm giving a short presentation on Kotlin tomorrow at my company, and this got me thinking about what to talk about, mainly which advantages/features of Kotlin might be useful/appealing to our development team.

So I've been thinking about is what are the greatest advantages of using Kotlin, and I think the biggest is the functional paradigms. But as a Java developer, I don't have a lot of experience in functional programming. I started reading the book "Functional Programming in Java", and this was somewhat helpful. Does anyone have any other good resources for learning good functional programming paradigms? Along the way I found this pretty good article by Bruce Eckel, the author of Thinking in Java: http://www.artima.com/weblogs/viewpost.jsp?thread=328540 It is about Scala, but I guess it can largely apply to Kotlin as well. It would be great if someone wrote an article like this that talks about Kotlin.

Anyway, here is the outline of the topics I was planning to talk about for this presentation:

- plays well with Java. Seamless integration with Java means that you can use it where it's useful/needed, but keep java code you already wrote, and refactor code slowly instead of having to throw out all your java code at once.

- first-class IDE developed by JetBrains

Here's what I was NOT planning to talk about... Builders, declaration/use-site variance, reified generics. I could talk about them, but I don't think the developerment team would care that much about it and honestly I don't understand these features very well myself... although they are definitely kool features

If anyone has any ideas, tips for a presentation, please reply. Also, does anyone have any resources I can use for a presentation? (good code examples, a slide deck, etc.) that could save me some time for this. Thanks!

Thanks for these additional points James, will defnitely will talk about these things too, I forgot to add javascript compilation to my outline. The only issue I have with "simple and very easy to learn" is that this a subjective point, but I agree that it is simpler and I personally like the Kotlin syntax a lot!

I noticed is that using Kotlin-style code with higher order functions, functions as parameters to other functions, etc. takes some time to adjust the brain. So while I agree it makes the code more readable ultimately, the declarations of functions can look pretty complicated. So I question if Java developers will find this functional code hard to read when they were always used to dealing with OO code.

One more question: what do you mean by "more stable binary story" than scala... are you talking about compiling Kotlin to a binary executable via LLVM or similar? If so, how feasible is this already, i.e. what prevents the implementation of this right away, aside from developerment bandwidth of course Just wondering because it would be pretty sweet if it were possible to create an android app and iOS app from the same codebase

I guess you could leave out the binary stability of scala issue; its only really applicable if you're talking to a scala crowd. But with scala whenever the compiler changes you pretty much have to have all your scala based dependent libraries rebuilt with the same version of the compiler & you have to upgrade all scala dependencies at the same time; so there's this big dependency-re-release dance which I don't really see scaling in the enterprise - though its fine for greenfield startup type environments. Typically folks in scala use sbt so that they re-release each release of a jar compiled against lots of different scala compiler versions. From Kotiln 1.0 this shouldn't be an issue; mostly as Kotlin avoids traits with fields & reuses the JDK's collections.

Ok, got it. I don't have any experience developing with scala so maybe I shouldn't talk about it, but that reminds me of the pain of dealing with incompatible jar dependencies in big maven projects. And that reminds me of another point, kotlin modules

Also the API documentation allows inclusion of blocks of code from test cases to help illustrate methods via the @includeFunction macro; so its easy to create testable documentation which is refactoring safe.

Finally the API documentation includes a source link both to the implementation of a method and its test case example code by default. For example if you hover over the Iterable<T>.filter() method description, notice the source links on the right which take you straight to the relevant lines of code in the github source code or test case.

I wouldn't push the functional aspect too much (if at all) because of all the baggage that comes with it and also because Kotlin doesn't go as far into functional programming as a few other languages.

I think the main value of Kotlin is that it's an incremental improvement over Java. The fact that some of these improvements are rooted in functional programming probably doesn't need to be mentioned if you are presenting to a crowd that is not already sold on the need for a better language.

Start by showing some paint points in Java and then show the equivalent Kotlin code, this should be enough to gain some attention.

Ok, thanks for explaining this Dody and Cedric, I guess I should look into it more. I asked what the big idea was because I've never thought to myself "gee, I wish I could use pattern matching in my Java code" so I wonder how useful it is, but maybe once I started using it then I would understand its usefulness.