Hacker News new | ask | show | jobs
by cyberroadie 5029 days ago
Here is one of the first empirical Scala vs Java studies: http://www.neverworkintheory.org/?p=375

Here is the actual paper: http://www.rz.uni-karlsruhe.de/~kb95/papers/pankratius-Scala...

Quote from the conclusion: With respect to effort, this study refutes the claim that Scala programs are faster to develop: in comparison to Java, Scala requires more effort, and especially more testing and debugging effort.

3 comments

This was a study that used Master's students who had been developing Java for 4 years and Scala for 4 weeks. It's pretty weak methodologically.
My anecdotal evidence agrees with the study. Type inference is also the reason the Scala compiler is so much slower than the Java compiler.
Scala has been on the market (i.e. promoted to a broader audience) since 2005 or so. There is plenty of evidence now that Scala is more complex than Java and less suitable for enterprise applications. Despite the fanboy-ism here and on reddit: the Scala hype is over. Definitly.
Having used Scala some myself, I wouldn't be surprised that if we look back in ten years, we have come to the conclusion that Scala is the C++ of modern times. It tries to support relatively opposing paradigms (functional programming - object oriented/imperative programming), has a very extensive type system, and drags in a lot of historical baggage via Java.

I guess everyone has encountered the C++ is 'C with better strings and arrays'-type of programmer who doesn't use RAII or the STL. Or the template-fanatic programmer that wants to drag in template meta-programming into every corner of the project. Or the STL fanatic that wants to replace every for-loop by a function in std::algorithm, even if there is no appropriate fit or it requires building a bunch of stateful function objects (thank god we have closures now). Etc.

If projects do not impose serious restrictions, such a broad language will quickly become an incomprehensible mess.

Being a recovering C++ fanatic myself, I believe more in smaller languages try to solve a particular problem now. For instance, take Prolog, it's a beautiful language for what it is aimed at: logic programming. All the weird object-oriented Prolog experiments have died out by now, and it's a language that you use when you want to solve a particular kind of problem.

Yes. Scala is C++ of the JVM.
Local type inference is not necessarily expensive. Type inference is abundantly used in Go, and yet it's probably one of the fastest compilers.

There are also languages that do Hindley–Milner type inference (ML, Haskell) with good compile times.

I am sure that you can have much cheaper type inference. However, if you turn on the compiler profiler for Scala, you can see that most of the time is spent in type inference. They don't do HM.
A couple of peculiarities in the study that place Java at a disadvantage:

1. Examples using outdated low level concurrency primitives such as wait and notify. Use of java.util.concurrent would have made the code much more terse and safe

2. Java performance affected by use of the outdated java.util.Stack class. It is well known that this class uses redundant synchronization. The docs recommend using a Deque implementation instead.