Kotlin and the Magic World of Java

Kotlin and the Magic World of Java

By Ümit Kara • October 25, 2022 • 3 mins read

From the beginning of my programming journey, I was unfamiliar with Java. It's not because I hate the language, but because I don't need it. When I first began learning programming, I became familiar with Visual Basic. While learning it, I noticed C#. Most of the time in my early programming years, I used C# to create command-line or graphical based programs. And I couldn't remember a time when C# wasn't sufficient or suitable for that occasion.

My mid-years passed with C++, Python, and C. Until now, I had not been in touch with Java. After I decided to work on some mobile development projects, I realized that this time would come. So here I am.

At the start of this month (October 2022), I started to learn Kotlin, a statically typed language that runs on the Java Virtual Machine, JVM for short. In order to learn Kotlin, I started with the documentation, and I found them to be very informative. Becaue I have prior knowledge, it doesn't take me long to get the essence of Kotlin. After working on some small projects for a month, I really liked Kotlin. It is a good language to use as a daily programming language to do most of the things I did with Python.

While working through Kotlin, I had a chance to look through the Java environment too. What I didn't like, and I'm sure most of the people agree with me, is the huge boilerplate code that you have to write. This is even for a small task. What makes Kotlin so powerful is that it doesn't need these huge unnecessary codes but does the same thing as Java. Also you can use Java libraries and packages. This is a remarkable opportunity.

After all of these explanations, I want to talk about Kotlin itself now. It is concise, safe and interoperable language. The language is an open source project that is mainly developed by JetBrains and backed by Google. At first glance, Kotlin is designed to replace Java at the pinnacle of mobile development, Android. As well as exceeding its main goal, it became popular for server-side development using frameworks such as Spring Boot.

Kotlin is a statically typed language, which means that the type of a variable is known at compile time. This allows the compiler to catch type errors early, making code more robust. Kotlin is also null-safe, which means that you can't assign a null value to a variable unless you explicitly mark it as nullable.

Kotlin is a concise language, which means that you can accomplish a lot with very short code. Kotlin also has powerful features like higher-order functions and lambdas that make code more expressive. It also is interoperable with Java, which means that you can use Kotlin in any Java project.

When we look at what I built with Kotlin, I developed 4 small command-line projects: A minesweeper game, a tasklit app, a watermark app and a calculator. Thanks to Kotlin, I had fun building these projects. By using its object-oriented and functional design, I was able to do things easily. By using it's obcects, I was able to get rid of unnecessary classes and do things in a simpler and cleaner way. As a final touht about it, I really liked Kotlin and I want to build some more stuff, maybe some beckend stuff with it. Also after seeing Kotlin, now I'm also curious about Scala and Groovy too. I didn't decide what I would study next month but these 2 will definitely be one of the options.