https://kotlinlang.org logo
Title
t

Tim Schraepen

02/05/2020, 9:44 PM
Hi everyone. I am in desperate need of your help. Who @here has references for (belgian) projects done in Kotlin and wants to share these references? I’m trying to build a stronger case to start using Kotlin as a strategy for the company I’m working for. Looking ideally at Kotlin projects as replacement for (typical) Java backend projects.
m

muliyul

02/06/2020, 10:17 AM
We're working with Kotlin, Dropwizard & Jersey to much success here at Next-Insurance. Most of our backend codebase is written in Kotlin. I think the language features, ease of use and onboarding for new Java hires, seamless integration with the Java ecosystem and maintainability of the code are the best assets of Kotlin. I'd start out by laying out the obvious benefits (like shorter code, [im]mutability and superb type safety features) and then laying out how your company can benefit from these (less bugs, easier maintainance etc...).
t

Tim Schraepen

02/06/2020, 3:30 PM
Thank you for the suggestion. This I’ve done already. Main arguments I’m getting right now are : from a dev perspective - kotlin only brings marginal gains (, and it’s an entire new language so I have to learn a whole other new language, ... this I classified under lack of knowledge and fear of the unknown, it’s approachable and within my circle of influence) harder to defend to customers - in the plethora of items we need to defend, like pairprogramming, TDD, devops, ...), having another battle to win might be one too many. This one is much harder to relay or fix and mostly outside my circle of influence.
c

corneil

02/06/2020, 8:35 PM
If the quality and speed of delivery is a problem then changing the programming language isn't going to make things better.
r

Renato Dinhani

02/09/2020, 1:39 AM
I migrated a GraphQL API gateway from Java to Kotlin. For me, Kotlin was an easier and more natural way to write "modern" Java. In Java I always had to remember to mark classes, variables and parameters as final, to pass and return Optionals, to have a lot of method overloads to handle optional parameters, to use external immutable collections, etc. The Java code was good, but it was not natural for other developers that are not used to these things. In Kotlin, all these things are the default in the language.
t

Tim Schraepen

02/09/2020, 2:37 PM
Thank you for that addition and the use of the word “natural”.
c

corneil

02/09/2020, 3:55 PM
I tell Java programmers at first: In your mind you lowlight certain Java code in order to understand the code. The parts that remain is basically Kotlin. Then you follow hints for more idiomatic Kotlin and quickly you are in a new safer world where you smile while coding.
t

Tim Schraepen

02/10/2020, 6:57 AM
Thanks for that!
c

corneil

02/10/2020, 8:21 AM
You're welcome!
p

pniederw

02/11/2020, 6:47 PM
I'd question "marginal gains". in my experience, the gains are substantial, even compared to java 13+.
if you keep coding in java style or keep using java frameworks that don't exploit kotlin's features, the difference may be less dramatic. personally I think that choosing kotlin over java for backends is a no-brainer in 2020, and that starting a new java project is almost irresponsible (because delivering the same project in java takes way more work).
backends increasingly use async i/o, and kotlin coroutines are a life saver there. dramatically simplified programming model compared to callbacks/futures/streams.
c

corneil

02/11/2020, 7:52 PM
For me Kotlin implies a reduction in cognitive load and complexity without giving up any power.
t

Tim Schraepen

02/12/2020, 8:40 PM
Ooph! That is very eloquently put Corneil du Plessis. Thanks for your addition to this thread @pniederw. Do you have any examples of coroutines vs. rx/callbacks/futures/streams that really show the pain in Java and the bliss in Kotlin? I personally don’t have proper experience with that so I didn’t feel like I could honestly use that as a good argument but I’ve been given the coroutines argument a couple of times now.
p

pniederw

02/12/2020, 10:09 PM
I don't have a pointer, but everyone who's written both blocking and non-blocking code in java knows that the latter is much harder to read and write (and debug). with coroutines, you write blocking code and get the scalability of non-blocking code. java will eventually catch up (project loom) but that's likely a few years off, especially if you stick to LTS versions.
c

corneil

02/13/2020, 7:08 AM
I imagine that the JVM version of coroutines will start leveraging Loom once it is available
p

pniederw

02/13/2020, 5:54 PM
so far, kotlin folks have answered this question with "we'll look into this once loom is ready".
c

corneil

02/13/2020, 5:58 PM
Obviously they need to make sure Loom is ready and stable and then decisions can be made. It could just make coroutines even more efficient if loom is delivering on the promises.
t

Tim Schraepen

02/14/2020, 5:26 PM
Thanks again folks. 🙏