by ryanobjc · 12y ago · 0 comments
My short handed criticism about Scala is this: It's the C++ of the JVM.
Specifically it has many features of C++ we thought we left behind: - slow compile times - complex language features and syntax
The language features have a benefit, and a cost. I just personally believe the cost outweighs the benefits for me.
I encourage you to take another look, as we often jump to criticisms with only a superficial understanding, often based on comments made on forums by other people. In particular, the idea of writing the code in a certain way to avoid recompilation is rather silly and I never, ever did it in the last 2 years since I worked with Scala.
On syntax and complex language features - having trained rookies unfamiliar with Scala myself, I can tell you - it's neither the syntax or the language features that are problematic, but rather the concepts involved. The Scala ecosystem is chock-full of paradigms coming from static FP languages such as Haskell. Scala's features are actually very elegant and orthogonal. It does have ugly corners that are a result of its interoperability with its host, the JVM, but that's a tradeoff I like, because people that don't like the JVM, haven't seen what it can do.
On compilation speed, it's not much of a problem though I understand why people don't like it. But the type system is very static - and in comparison with Java in which the type system does nothing else but to stay in your way - in Scala it actually helps you to write code that is sometimes provably correct or to design safe and user-friendly APIs. For me it's not a problem if my code takes an extra couple of seconds to compile, because the compiler does help me in the case of Scala. In terms of recent developments, both SBT and Maven are doing incremental compilation. Plus, SBT makes it really, really easy to break your project into multiple sub-projects that depend on each other, to keep them small, something which helps with compilation speed though personally I do it for keeping the code base cleaner.
See other comments below where co-founder of Typesafe (who has quit) gave a talk explaining why Scala is doing everything wrong.
In his video he has a slide with the words "No wonder nothing works" and on the slide:
scala> val x1: Float = Long.MaxValue
x1: Float = 9.223372E18
scala> val x2: Float = Long.MaxValue - Int.MaxValue
x2: Float = 9.223372E18
scala> println(x1 == x2)
true
This is the guy who has worked on the Scala compiler. He says it will never be fast and there are things which are fundamentally broken (like above, and there are many more).I think any start-up using Scala is making a big mistake.
> This is the guy who has worked on the Scala compiler. He says it will never be fast and there are things which are fundamentally broken (like above, and there are many more).
He also says it's the best language available at the moment. And he's right.
> val x: BigDecimal = Long.MaxValue
Problem solved. Or is it?
If that's what you've understood from that talk, then you haven't heard basically anything he said.
> val x1: Float = Long.MaxValue
OK, I'll byte, name your (safe for startups) programming language that presumably doesn't do that.
"Scala is to Java what C++ is to C".
http://parleys.com/play/528cbfc3e4b084eb60ac78f2/about
With slides: http://www.slideshare.net/extempore/keynote-pnw-scala-2013
The main take-away imo is the line "every increase in expressiveness brings an increased burden on all who care to understand the message"
That line basically why I am not as fond of Scala as I originally was.
My defense of the inevitable "well hire smarter developers then!" is twofold (a) You're saying Scala is not a mass market audience language and (b) you aren't as smart as you at 4am, after you were just woken up because your code is broken in production.