I am tasked with convincing my team to adopt Kotli...
# getting-started
n
I am tasked with convincing my team to adopt Kotlin. What are key features of Kotlin and its long term trend? Thanks
p
null safety, good concurrency primitives, less boilerplate, good java interop.
1
j
What kind of system/product is your team working on? JVM backend/service? Web app with frontend and backend? Android application? Android+iOS applications? (the features to highlight might be different depending on this)
l
In terms of future trends, I think that’s the primary advantage. Kotlin is still rapidly improving. With things like #compose-ios, Swagger integration with #ktor, better performance, more stable plugin SDK, and lower build times with K2, there’s a lot to look forward to.
👍 1
n
@Joffrey it is a backend service.
j
Currently in Java?
n
yes, so now considering Java vs JS vs Kotlin,
is there a bench mark test on the performance and build time?
j
Then I would highlight first the much better type system, with built-in nullability and much better generics (Java's are really broken), while still preserving the great JVM ecosystem and performance for servers. Note that with Kotlin coroutines you can also have non-blocking request handling pretty easily, and write safer concurrent code in general.
🙏 1
n
any good tutorial on Kotlin Coroutines? I have heard of it much better non-blocking api request, I am curious how that is in comparing with JS Async await.
j
There is a sort of list comparing different approaches to asynchronous programming (threads, callbacks, futures/promises, reactive streams, coroutines) on the Kotlinlang website: https://kotlinlang.org/docs/async-programming.html I'd suggest reading the official docs about coroutines as a starting point if you want to learn about them: https://kotlinlang.org/docs/coroutines-overview.html
🙏 1
k
Some thoughts in support of Kotlin: 1. Java programmers typically find Kotlin easy to learn and are productive with it fairly quickly; therefore as long as your company is willing to spend a small amount of training time you already have a good supply of developers both from your existing team and externally as you can recruit Java developers, and there are increasingly more potential recruits with Kotlin experience already. 2. Surveys have shown (e.g. https://www.overops.com/blog/the-top-10-exceptions-types-in-production-java-applications-based-on-1b-events/) that the most common runtime error that happens in production is NullPointerException. Kotlin syntax makes it more difficult to neglect situations where such an error can arise. 3. Kotlin is more succinct, so fewer lines mean less chance of errors and less development time.
🙏 1
n
Thank you! These are very good pointers for me to start out. Much appreciated.
l
Kotlin also directly interops with Java, so if you want to keep your existing framework, you can start migrating code over one file at a time.