Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

By duckladydinh, history, 10 months ago, ,

After experimenting with Kotlin for a long time, my love for Java grows. Here are a few points I strongly believe that Java is better...

1. Worse parameter type casting. It is even worse compared to Java. At least, Java could detect an int object in a long parameter. Now if I create a method for long, I need to create int wrapper for it.

2. Hardship to create multidimensional array. Even if I agree that linear array is almost 99% of the case in real world scenario, if we somehow need it, like for CP, it is a terrible experience.

3. Immutable function parameters. It should be fine if the outside fields are immutable, but now, even within the scope of the function, we have to declare new variables and if we use the same name, we got the warning "shadowed name". It is even worse than Java.

4. No real interop for functional features in Java and lambda is a bit worse. This is not related to CP, but for software engineering. Another reason to not adopt it.

Well, there are more, but after trying Kotlin for sometime, I am increasing doubtful of its existence. There are hardly strong evidence for it in my opinion. Do you have any idea?

Thanks!

• +16

 » 10 months ago, # |   -22 Then, by all your above arguments, there is no doubt Python is the best language. Done automatically array = [[0,]*m for i in range(n)] Well all arrays in Python are passed by reference, but other than that there's nothing. ... I think Python, from a functional perspective, is amazing.
•  » » 10 months ago, # ^ |   -7 Also try JavaScript!
•  » » » 10 months ago, # ^ |   -15 Okay, fair, Kotlin is nicer than JS in my opinion, I just mean it is still no match for Java even thought I thought it was supposed to correct Java.
•  » » 10 months ago, # ^ | ← Rev. 2 →   -15 Python is pretty amazing, isn't it? My only problem with Python is that it is slow and no type (-> almost no good intellisense) or at least people normally use no type hint. Overall, it is a good interpreted language compared to R, Ruby and not sure but JS.
 » 10 months ago, # |   -10 Auto comment: topic has been updated by duckladydinh (previous revision, new revision, compare).
 » 10 months ago, # |   0 Have you tried Scala?1 You can pass Int for a Long (but not the other way around): def f(x: Long) = x % 10 val y = 1 //Int f(y) 2 Easy: val n, m = 100 Array.ofDim[Int](n, m) Array.fill(n, m)(42) Array.tabulate(n, m) { (i, j) => i + j } 3 Value parameters are immutable by design. Sometimes I find it a bit inconvenient myself. I guess Java scores here. The score then is roughly 1 : 100 :)4 The interop is there (hard to comment without seeing any concrete issues), I don't remember having to resort to inferior functional features of Java, ever. Scala standard library is feature rich beyond comparison with Java (or Kotlin, or probably any other language), especially when it comes to collection support.
•  » » 10 months ago, # ^ |   0 I never use Scala since I found it a bit more troublesome when I tried to start long ago (for Kotlin, learning it with Java knowledge and intellij took almost no time). Yeah, it looks really nicer in many ways, but I just mean that I am disappointed about Kotlin since I thought a good Java's alternative has been found and whenever I attempted to use in a real case and things soon got problematic. I mean even if the score is 1:100, in the 1% case when you really need a feature and it is not there, it would mean disaster since it may have been too late to pick another.