DEV Community

Discussion on: Java or kotlin?

Collapse
 
_hs_ profile image
HS

After looking at Groovy and Scala I didn't see the point of Kotlin. I'm trying to write an API in it just check will it grow on me but I don't see the benefit in many cases for now. I'm using Java 11 and hopefully switching to Java 14 soon so a lot will be gone from the pro side of Kotlin. If you write anemic classes than Kotlin. Simple to deliver CRUD fast. If you want real domain things it's just to much to get used to how to overide those getters and setters. Too confusing so I end up writting privats with custom getter and setter just to override something like add parameter to setter or such. It's just my current style of development.

Collapse
 
rawtoast profile image
RawToast

For backend development, I would also prefer Scala; however, Kotlin is very popular for Android development. Last time I checked it wasn't possible to use Scala on Android (or you had to use an old version).

Collapse
 
_hs_ profile image
HS

Yup. Anyways I'm pointing out that if I wanted faster development for backend it's hard to skip Groovy and use Kotlin, I just don't see it. On the other hand, Scala is also great and had val, var, pattern matching, reactive features, way before anyone heard of Kotlin so why switch to it? Java 14 has a lot of good stuff, maybe immutability is not there yet but I don't use it that much. You can achive it if you do good domain models. Example, I avoid getter/setter in domain part if I know what should domian do. Dtos are generated by IDE anyways huehue. If Java records get copy featute I think that's it for me. For now it looks like simple class