DEV Community

Discussion on: Kotlin vs Java: 10 Years In

Collapse
siy profile image
Sergiy Yevtushenko
  1. Java supports exactly the same paradigms and exactly to the same level as Kotlin. None of them support advanced FP features like higher kinded types.
  2. Static members in Java can be mutable and immutable. "Top level functions" in Kotlin have no advantages over Java static methods (and static imports makes them indistinguishable in code). Instead Kotlin's "freedom" quickly result to mess in codebase and requires extra efforts to keep can with worms under control. Extension methods blur class API and also require extra efforts to prevent appearing of similar extension methods written by different developers.
  3. Lack of mandatory semicolon makes another Kotlin feature - infix functions - very fragile. Often attempt to reformat code may result to compilation errors.
  4. Completely useless feature, IMHO. Leave scripts to scripting languages.
  5. Java can be used in a way when NPE is as rare as in Kotlin. And it can do this in consistent and composable way, which does not require cryptic optional chaining.

For backend development Kotlin is sensibly worse than Java as it requires significant efforts to keep code properly organized - freedom of placing classes/functions in files and extension methods tend to quickly make codebase a blob of cold spaghetty. To prevent this one needs to have conventions and spend efforts to maintain them.

Overall Kotlin always lefts aftertaste of poorly thought out language with many features hacked ad-hoc. Several context-specific keywords and miriad of special cases makes Kotlin much harder to master than Java.