You are viewing content from a past/completed QCon

Presentation: Why Bother With Kotlin - Not Just Another Language Tour

Track: Modern Java Reloaded

Location: Majestic Complex, 6th fl.

Duration: 2:55pm - 3:45pm

Day of week: Thursday

Level: Intermediate

Persona: Developer, Developer, JVM

Share this on:

This presentation is now available to view on InfoQ.com

Watch video

What You’ll Learn

  • Learn some of the big ticket items that make Kotlin worth the investment to master.

  • Hear about features like coroutines, extension methods, KotlinJS, and Kotlin Native.

  • Understand areas where Kotlin might make sense and where interop support a mixed language environment.

Abstract

Most presentations introducing a new programming language are really just simple language tours.  A lot of interesting language features are shown but it's not always clear *why* one would choose to adopt that new language. This presentation will start by looking at the layout and syntax of Kotlin projects.  We'll gain a grasp of broad strokes of Kotlin syntax. But from there we'll move to a more in-depth discussion how these new language features combine to present a compelling new alternative to the Java source language.  We'll look at a few "big ticket" features of the language and its ecosystem that do more to distinguish Kotlin than mere syntax sugar alone can provide.

This is talk is largely driven by code from the IDE.  Apart from some initial introductory slides, everything else happens in IDE or the command shell.  The talk is designed to cover a handful of interesting bigger ticket items rather than every single little nuance of the language.  Because, while syntax can be important, ultimately it's not a large factor when it comes to language adoption. Larger scale, dare I say, higher order features that can truly drive productivity ultimately win the day.  This talk is designed to highlight some of those features.

Question: 

Why should a developer come to this talk?

Answer: 

The way I like to describe Kotlin is that it has a lot of the advanced features that as a Java developer I'd look at Scala for. These are things that I think would be so nice if I could do it in Java. Kotlin has some of these nicer features, but it doesn't have all the complexity that Scala has. For me, Kotlin is a nice middle ground because it has some nice features but it doesn't require you to use all of them (Ohh and the interop between Java and Kotlin is pretty amazing). Kotlin is the first non-Java JVM language that I truly get excited about.

Question: 

How are you planning to deliver this talk?

Answer: 

I'm going to go straight to Kotlin.

This is a variant of two talks I've given. One I've been calling Kotlin from the Ground Up. It's really for beginning Kotlin programmers. It's a language tour that has all the bits that make up Kotlin. The other Kotlin talk I give was called Why Bother with Kotlin. That's more about the big-ticket items. Syntax is nice and all, but if that's all you're getting why bother?

So what this talk is going to be is it's going to be a little bit of here's what cutting code looks like. We were thinking it might be good to start off with that so people can really see what the syntax is so it's not quite so strange.

After this brief tidbit of what makes Kotlin interesting, we'll jump into the higher-level features of the language and the ecosystem. The idea is that these are a feature that makes the effort of learning this new syntax worth it.

Question: 

What are some of the big-ticket items you plan to go into?

Answer: 

To start, Kotlin has extension functions. They are basically compiled into static methods, but it's an effective way to really reduce your code and improve readability.  This isn’t a new feature the Kotlin developers created but it’ll be a treat for those coming from Java. Then I'm going to talk about a feature called implementation by delegation with side-by-side examples in Java and Kotlin.

I'll show the Streaming API, which is awesome in Java 8, but the Kotlin version is still cleaner.

I'll look at Kotlin's multi-platform support. With one codebase you can write a Java backend, a mobile (Android or iOS) frontend, and web-based Javascript frontend if you wanted too. So you can have shared data models, business logic written in one place, use one language. Then you can compile down the bits that you need. There are interesting things that happen when you do this. For example, your refactorings can work across all your projects (so if you rename a method in a multiplatform project, all the reference get renamed and you don't have to go hunt down reference to make sure it still works).

Question: 

Will you be focusing on LLVM or KoltinJS?

Answer: 

Both actually. KoltinJS which transpiles Kotlin code into Javascript.  And then there’s Kotlin native which compiles your Kotlin code into LLVM bytecode for native executables.

Speaker: Justin Lee

Principal Software Engineer @RedHat

Justin Lee is a Java Champion and Principal Software Engineer at Red Hat. He has been programming in Java since 1996. He has worked on virtually every level of the application stack from database drivers all the way to application servers and front end interfaces. A long time advocate of Java, he has spoken at conferences and user groups all across the US and Europe. He is an active open source community member and can be found on twitter and github as @evanchooly.

Find Justin Lee at

Last Year's Tracks

Monday, 24 June

Tuesday, 25 June

Wednesday, 26 June