In praise of Kotlin. A modern programming language.

von Lukas Hörhan und Georg Baumann | 30. August 2023 | English, Software Engineering, Tools & Frameworks

Lukas Hörhan

Senior Developer

Georg Baumann

Senior Developer

Embracing Kotlin Over Java: A Strategic Move in Software Development

In the dynamic world of software development, making strategic decisions about the tools you use can be a game-changer. While Java has been one of the default programming languages in Europe when it comes to robust, scalable and portable programming languages, the tech world continues to evolve. This evolution has given rise to new solutions and alternatives. A noteworthy standout in this innovation drive is Kotlin – a statically typed language designed to run on the Java Virtual Machine (JVM). As developers with years of experience in Java, our recent venture into a Kotlin-based project was an enlightening journey.

Upon reflecting on the success of our Kotlin project and as we gear up for new ones, we find ourselves strongly advocating for Kotlin over Java. Despite the invaluable experience and success we’ve had with Java, we believe Kotlin’s modern features, readability, and seamless interoperability with Java better align with the requirements of our present and future projects. Let’s explore why:

A Journey From Java to Kotlin

Java, since its introduction in 1995 by Sun Microsystems, has been a preferred choice for developers across the globe, praised for its robustness, compatibility, and scalability. However, in a sector as dynamic as software development, continual modernization is the order of the day. Recognizing this need, JetBrains introduced Kotlin in 2011 as a modern, statically typed language designed to run on the Java Virtual Machine (JVM). By 2019, Kotlin had gained Google’s endorsement as its preferred language for Android app development, solidifying its standing in the developer community.

Kotlin: A Wise Decision

According to the Stack Overflow Survey from 2022, while 33% of professional developers use Java, only 9.9% use Kotlin. So why should management decide to kick-start a new project with Kotlin, or even consider migrating from Java to Kotlin?

Talent Acquisition

Software development’s dynamic job market reflects the ever-changing interplay between various programming languages. To gauge the current status, we conducted a comprehensive analysis of the job market for Java and Kotlin developers. The research covered major job portals, focusing specifically on Germany and including remote opportunities.

The job titles Java Developer and Kotlin Developer were utilized to benchmark the number of available positions. The results, subsequently analyzed on a percentage basis, unveiled a striking disparity: approximately 90% of the listed positions across all job portals targeted Java developers, while Kotlin developers constituted just about 10% of the demand.

Here’s the breakdown of our findings:

Source Java Developer Jobs Kotlin Developer Jobs
Indeed 90.23% 9.77%
Jobs.de 90.20% 9.80%
LinkedIn 91.18% 8.82%
Stepstone 88.80% 11.20%
Xing 90.13% 9.87%

At first glance, these statistics might seem disheartening for Kotlin enthusiasts. However, we argue that they reveal an incredible opportunity for both companies and Kotlin developers.

For companies seeking Kotlin developers, the relatively low demand signifies less competition. This is an excellent opportunity to secure top-tier talent in a less saturated market. With the growing popularity and adoption of Kotlin, organizations can gain a competitive edge by investing in a rapidly growing technology that has yet to reach saturation in the job market.

Kotlin’s Growth Momentum

In the evolving landscape of software development over the last six years, a compelling trend has surfaced. While Java has consistently maintained a strong standing, Kotlin is carving out an ever-expanding niche for itself. GitHub, as a principal gathering place for the global developer community, provides compelling evidence of this shift in preference. To understand this trend, we’ve examined the data on newly created repositories for each language on GitHub.

 Year   New Kotlin Repositories   Kotlin Growth   New Java Repositories   Java Growth 
2017 26,275  –  1,251,887  –
2018 69,938  166.36%  1,522,193  21.58%
2019 121,426  73.63%  1,658,514  8.94%
2020 187,943  54.78%  1,848,997  11.48%
2021 257,963  37.30%  1,943,642  5.12%
2022 320,199  24.15%  2,304,488  18.58%

Kotlin’s rise is hard to ignore. Even though the annual growth rate percentage has shown some reduction, the actual number of new repositories in Kotlin has steadily increased each year, indicating a continually widening user base and adoption.

Java, despite its well-established presence and massive user base, shows a more inconsistent growth rate. It’s noteworthy that in 2021, Java saw the smallest percentage increase in new repositories in recent years, growing by only 5.12%, while Kotlin still managed a growth of 37.30%. In 2022, Java’s growth rate has seen an uptick, yet it still doesn’t match the pace of Kotlin’s increasing popularity.

While the total volume of Java repositories is undoubtedly higher, it’s important to remember that Java has a head start of more than two decades. In a remarkably shorter span of time, Kotlin’s progress has been swift and steady.

So, if you’re considering picking up a new language, or you’re an organization making decisions about which language to use for your next project, Kotlin’s increasing popularity and its adoption rate suggest that it’s definitely worth a look. Kotlin’s continued growth signifies a vibrant and engaged developer community which is constantly expanding. While Java certainly won’t be disappearing any time soon, the rising trend of Kotlin is a testament to its capabilities and potential in the world of programming.

Enhancing Developer Satisfaction: A Technical Perspective

According to the Stack Overflow Survey from 2022, over 63% of developers favor Kotlin, while more than 54% find Java less appealing. This preference is not without reason; technical features like Null Safety, Extension Functions, Coroutines, and Functional Programming are just the tip of the iceberg. Although several blog posts, such as this one from freecodecamp.com, have elaborated on these aspects, we won’t delve into the details here.

A Closer Look: Additional Reflections on Kotlin

In the following sections, we will delve deeper into our experiences with Kotlin, shedding light on its ease of learning, efficiency, flexibility, maturity, and seamless compatibility with existing Java frameworks.

Ease of Learning

Kotlin is fairly simple to learn, especially for developers who are already well-acquainted with Java. This ease of transition meant that our development process was not significantly disrupted during the switch. In fact, the team morale actually improved during this period. This uplift is likely attributable to developers’ enthusiasm for mastering and employing cutting-edge, efficient tools and programming languages.

Boosting Efficiency and Reliability

With an expressive syntax that significantly trims verbosity, Kotlin includes powerful functional programming features like higher-order functions and lambda expressions, thus leading to more declarative and reliable code. Furthermore, Kotlin’s inherent null safety features help eliminate common bugs, enhancing the robustness of our applications. The language’s built-in coroutines support also eases asynchronous programming, paving the way for efficient concurrent applications.

Flexibility in Code Structure

Kotlin’s flexibility far exceeds the traditional Java convention of one class per file. It allows the definition of multiple classes, data classes, objects, and top-level functions in a single file. This flexibility empowers developers to logically group closely related classes and functions, promoting comprehensibility and maintainability. While beneficial, it’s paramount to exercise this flexibility judiciously to prevent files from becoming overly complex or unwieldy. Though Kotlin’s freedom may alter the project structure compared to Java, the transition remains simple. Developers also retain the option to adhere to a more class-centric structure if they prefer.

Youthful Yet Proven

Despite being just released a decade ago, Kotlin has already matured greatly. Throughout our years of building various microservices with Kotlin, we have yet to face issues directly attributable to the language. Kotlin has proven itself to be robust and reliable, capable of handling complex systems with grace and efficiency. This demonstrated maturity, despite its relative youth, gave us increased confidence in our decision to adopt Kotlin, and we were pleased to find that it exceeded our expectations in terms of stability and performance.

Seamless Compatibility with Java Frameworks

Kotlin integrates seamlessly with popular Java frameworks such as Spring, Hibernate and Vaadin. Their usage remains largely the same, negating the need for an extensive acclimatization period or arduous migration process. This ease of integration smoothed our transition to Kotlin, enabling us to leverage Kotlin’s power while continuing to utilize our familiar tools and frameworks. As a result, we quickly reached a state of comfort and productivity, facilitating a smooth transition and the ongoing delivery of high-quality software.

Our Conclusion

A casual, non-representative survey among our colleagues at Senacor revealed that many new projects are started with Java. This is often because Kotlin is seen as an unknown entity. This worry affects everyone from management, who may fear they won’t find the right Kotlin developers, or are hesitant to take on the risk, to developers who doubt they can apply their Java skills effectively in Kotlin.

However, after reading this article, we hope to have addressed these concerns. We aim to encourage you to consider Kotlin for your upcoming projects, and in doing so, ignite the creation of impressive new Kotlin applications.

We can wholeheartedly recommend Kotlin to any developer who is thinking about trying one of the most modern and future-proof JVM programming languages. In our experience, Kotlin provides a significant step forward in safety, conciseness, and overall coding satisfaction. Give Kotlin a try, and you might find a new favorite language for your programming journey.