Maybe yes, maybe no, maybe Kotlin. I don’t know

I’ve been working as a Java Sofware Engineer for a while already, and recently I started thinking about new opportunities. One of the exciting positions was about moving totally from Java to Kotlin, so I wanted to understand the benefits there for me and if it’s worth my time. I did some research and want to share my results with you.

What is Kotlin?

How did I hear about Kotlin?

DTO with Java and Lombok:

import lombok.Data;
import java.time.LocalDate;

@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
public class UserDtoJava {
int id;
String name;
LocalDate birthDate;

DTO with Kotlin:

import java.time.LocalDate

data class UserDtoKotlin(
val id: Int,
val name: String,
val birthDate: LocalDate

The size of the code is almost identical, but, as you can see, with Kotlin, it is already part of the language, and that is great. Among other notable improvements, here are some that I liked most in Kotlin:

  • Null-safety,
  • Coroutines,
  • Extension Functions.

Also, Java and Kotlin have interoperability. It means that some parts of your code can be written in Java and some in Kotlin, even in one project (but that might be not a good idea). Here is an example of using the above Java DTO in the Kotlin function:

import java.time.LocalDate

fun newUser(name: String): UserDtoJava {
return UserDtoJava(1, name,

Kotlin vs Python

At that time, Kotlin and Python were next to each other (maybe it is still valid), and it was obvious to compare them first. To visualize the difference, I built a little flow diagram:

My verdict

As for now, I found a solution to learn Kotlin “smoothly”. I started using it to write my Unit Test. That approach helps me not to bring mess to my existing Java code but still learn Kotlin and enjoy its new features.

By the way, here is an article that inspired me to do so.

Experienced Software Engineer that likes to work not only with machines

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store