You are viewing content from a past/completed QCon -

Presentation: Fresh Async With Kotlin

Track: Evolving Java

Location: Seacliff ABC

Day of week:

Slides: Download Slides

Level: Intermediate - Advanced

Persona: Architect, Backend Developer, Developer, Developer, JVM, Front-end Developer, General Software, Mobile Developer, Technical Engineering Manager

What You’ll Learn

  • Hear how asynchronous programming is done in various languages.
  • Find out how Kotlin does asynchronous based on code samples that vary from simple to complex.

Abstract

Asynchronous programming is on the rise. Modern software systems are connected and constantly communicating. Programming languages are adding some form of asynchronous programming like async/await. However, Kotlin had taken a fresh approach to this problem with Kotlin Coroutines.

In this talk, we’ll study various approaches to asynchronous programming, their evolution, differences and similarities. We’ll see the problem with the traditional async/await approach that is based on futures/promises and how the Kotlin’s solution that is based on concepts of coroutines and continuations is giving us safer and easier programming model.

Question: 

What is the primary role that you have with Kotlin at JetBrains?

Answer: 

I'm currently leading the team of Kotlin libraries. We are working in close cooperation with Kotlin language team, the design, etc..

Question: 

What made you want to do this talk?

Answer: 

Part of the reason is the way we designed asynchronicity Kotlin, it is novel. There are things you can't find in other languages. It's less familiar to people, so we need to spend some time explaining it to people, what is different, how it works, and why would we chose to do async in this wait instead of how other languages are doing it.

Question: 

Are you going through various async approaches?

Answer: 

Yes. I want to start with callbacks, which is a classic approach, very popular in JavaScript/Node.js world. Then we'll see Futures and Promises. That's how modern languages approach async. Then we'll jump to Kotlin, how async is different, cleaner, easier. In a way it's very similar, but it removes a layer of complexity from the language

Question: 

Regarding coroutines, are you talking about it from the syntax approach or about implementation details?

Answer: 

I would show both how you use it and a little bit how it's implemented by the compiler. How it translates into Java bytecode if you were doing it manually to dispel the magic. Then I'll show a couple of practical scenarios, how to use it. Here is the task you have in hand, then you write the async call. How you start from taking your async I/O library that most people use and adapt it to work with coroutines. I will take a simple example and show how to build a more complex one.

Question: 

Who are you talking to? The Java developer, the Kotlin developer, the JVM developer? An architect? A language designer?

Answer: 

The main persona I envision is a developer. It's more about concepts, but I show the actual code. It should be easily to understand for JVM developers, but it is not problem to grasp it even if you come from another world, JS or Swift. It should be pretty self-explaining because the code we will be showing you'll be able to read even if you don't know the language.

Speaker: Roman Elizarov

Software Engineer Developing Kotlin @JetBrains

Roman Elizarov is a professional software developer with more than 16 years of experience. He had started his career at Devexperts, where he designed and developed high-performance trading software for leading brokerage firms and market data delivery services that routinely handle millions of events per second. He is an expert in Java and JVM, particularly in concurrency, real-time data processing, algorithms and performance optimizations for modern architectures. Roman currently works on Kotlin language at JetBrains. In 2000 Roman had graduated from St. Petersburg ITMO. He now teaches a course on concurrent and distributed programming in ITMO. During his undergraduate study he participated at ACM International Collegiate Programming Contest (ICPC). Since 1997 and until now Roman serves as a Chief Judge of Northeastern European Regional Programming Contest (NEERC) of ICPC.

Find Roman Elizarov at