The document discusses migrating a Java project to Kotlin. It introduces Paulien van Alst and her experience migrating a project from Java to Kotlin at bol.com. The migration plan involves setting up Kotlin dependencies, migrating POJOs, continuing with business logic, and finishing configuration. Code examples are provided for each step. Overall the migration was smooth, with some Spring integration tricks. The resulting Kotlin code is more readable and concise.
Scaling API-first – The story of a global engineering organization
From Java to Kotlin: The Smooth Migration
1. From Java to Kotlin
The adventures of a smooth migration
September 29th @NextBuild
www.openvalue.nl @PaulienVanAlst
2. Who Am I ?
www.openvalue.nl @PaulienVanAlst
• Paulien van Alst, software
engineer @OpenValue
• Data science, simplifying code
&& new coding languages
• Passionate about sports
• Like to play boardgames
• You can find me on Twitter!
3. My story with Kotlin
• Discovered it in 2017
• Used to work at bol.com
• Refactored our service from Java to Kotlin
• Giving Kotlin workshops
www.openvalue.nl @PaulienVanAlst
4. So… what is Kotlin
• Developed by Jetbrains, named after Kotlin
•
www.openvalue.nl @PaulienVanAlst
5. So… what is Kotlin
• Runs on JVM (Java 6, 7, 8 bytecode)
• Can also be compiled to JavaScript code
• Android Studio 3.0, fully supported by Google
www.openvalue.nl @PaulienVanAlst
6. Kotlin: basics
• No statement terminator
• Variables in Kotlin can be immutable
• Class members are public by default
• Class are final by default
• Null safety
• Collections “are streams”
www.openvalue.nl @PaulienVanAlst
val average = ratesOfTheBoardGame.map { it.rate }.average()
7. Kotlin and Java
Fully interoperable with the Java ecosystem
• Maven, Gradle, Ant
• Spring (Boot) (with some tricks)
Editors
• IntelliJ
• Android Studio
• Emacs with Kotlin Mode
• Eclipse with Kotlin plugin
www.openvalue.nl @PaulienVanAlst
18. Wrap up
• Migrating goes smooth
• Some tricks Spring
• Code is more readable
• Less is more!
www.openvalue.nl @PaulienVanAlst
19. Coming up
Want to learn more?
JFall : Workshop about Kotlin
Contact us (OpenValue) for trainings
References for the talk:
Code will be on GitHub (PaulienVA)
Slides on SlideShare
www.openvalue.nl @PaulienVanAlst