Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

A general overview of the similarities and differences of Java + Kotlin development, the start of a conversation with the existing Open edX Mobile development team members on assessing the new Kotlin based code base.

TL;DR: The future is Kotlin, and it has been here for years. Switch ASAP. 🎤


Key Coverage Areas:

1 - Benefits of Java → Kotlin Switch

2 - Drawbacks of Java → Kotlin Switch

3 - Kotlin Resources

Benefits of Java → Kotlin Switch

Transitioning to development using Kotlin over Java for Android applications offers several benefits:

  • Increased productivity: Kotlin requires less boilerplate code than Java, which means developers can write code more quickly and with fewer errors. This can increase productivity and reduce development time. This point seems to be somewhat disputed in various articles however (smile) . And speaking of happiness, (thanks emoji,) Android developers surveyed by Google self-reported satisfaction 25 points higher on a scale they conveniently forgot to specify 😃 .

  • Improved safety: Kotlin is null-safe, which means it can help prevent null pointer exceptions, a common source of crashes in Java applications. This can improve overall application stability and reliability. #DownWithNullPointerExceptions. The Google Home team saw a 33% reduction in errors with the shift to Kotlin, attributed to those pesky Java errors ☕ of yesteryear.

  • Interoperability with Java: Kotlin is fully interoperable with Java, which means developers can use both languages in the same project. This makes it easy to gradually transition from Java to Kotlin without having to rewrite existing code. This has been the current operating model for new Android code in our mobile applications, with some areas of the application already transitioned over to Kotlin.

  • Improved readability: Kotlin has a more concise and expressive syntax than Java, which can make code easier to read and understand. This can improve code quality and reduce the likelihood of errors.

  • The future is Kotlin: As of Feb 2023, approximately 95% of the top 1,000 Android applications on the Google Play Store are written in Kotlin. This was about 70% in 2021, showing the continued shift in default away from Java development for Android applications.

Drawbacks of Java → Kotlin Switch

Some potential drawbacks to using Kotlin over Java in Android mobile app development include:

  • Less mature ecosystem: Kotlin is a relatively new language compared to Java, which means there may be fewer resources or libraries available for developers to use.

  • Learning curve: Although Kotlin is designed to be easy to learn for Java developers, there is still a learning curve associated with switching to a new language. Recent statistics from Google do suggest 60% of Android developers have switched to Kotlin or at least use it professionally for some of their work.

  • Build times: Kotlin can sometimes result in slower build times than Java, particularly in larger projects. Whether or not this is a factor for our appications is unclear, since ironically build times and increased productivity is cited as a common benefit of Kotlin. 😕

  • IDE support: Although most popular IDEs support Kotlin, there may be some compatibility issues or bugs that need to be addressed. While some articles describe this gap, I have a feeling based on how quickly facts and figured about Kotlin have changed in the last 4 years that this might be outdated as well.

Kotlin Resources + Reading

  • No labels