duckladydinh's blog

By duckladydinh, history, 4 weeks ago, In English,

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!

 
 
 
 
  • Vote: I like it
  • +16
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it -22 Vote: I do not like it

Then, by all your above arguments, there is no doubt Python is the best language.

  1. Done automatically
  2. array = [[0,]*m for i in range(n)]
  3. Well all arrays in Python are passed by reference, but other than that there's nothing.
  4. ... I think Python, from a functional perspective, is amazing.
  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it -7 Vote: I do not like it

    Also try JavaScript!

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it -15 Vote: I do not like it

      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.

  • »
    »
    4 weeks ago, # ^ |
    Rev. 2   Vote: I like it -15 Vote: I do not like it

    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.

»
4 weeks ago, # |
  Vote: I like it -10 Vote: I do not like it

Auto comment: topic has been updated by duckladydinh (previous revision, new revision, compare).

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.