Ask HN: Why do people have a hatred for Scala?
I'm learning Java and Ruby, and I saw few posts about functional programming. So I thought that the next step should be learn a FP language. But I saw so many people hating Scala. Is there a reason for this?
edit: Ok, Hatred is a strong word. I shoud have used dislike instead.
133 comments
[ 3.8 ms ] story [ 206 ms ] threadApart from occasional issues in the community Scala is criticised for being too complex: https://www.youtube.com/watch?v=uiJycy6dFSQ
I think Paul Phillips agree with the overall direction of Scala and thinks it's the best programming language out there, but disagrees on design details and compiler inner workings.
http://stackoverflow.com/research/developer-survey-2015#tech...
But you are completely right that there's also a lot of negative sentiment around it. Here are two possible reasons I can think of (I am sure there are others).
1. Scala does not form part of an established programming language tribe. It is neither a better Java nor a Haskell on the JVM. So people are challenged in their assumptions; they don't know what it is, and react negatively in order not to have to learn more.
2. Scala is pretty successful. So people in neighbouring language communities sometimes feel frustrated that a seemingly (to them) inferior language gets traction and their perfect language gets less. I saw some of that when Java eclipsed Smalltalk in the 90's. I never met a community as spiteful of Java as the Smalltalk one.
The thing that fascinates me is scala is like an art. It's like a new Obfuscated Perl Contest, but for functional programming. It doesn't really serve a purpose in legitimate business.
Scala code doesn't scale, it compiles too slow due to having too many features in the syntax. They took features normally meant for a standard library / external projects and literally augmented them into the syntax.
Scala, in it's current form, is a pipe dream. It really needs to be start over, but drastically simplified. Perhaps it should try to take a hit from Golang for compiler time advice: Simple languages compile fast and are easier to optimize.
Not as verbose as Java -> Java is probably the most verbose compiled OOP language
Refactoring is safer than it would be in JS -> I think with the IDEs this means almost nothing.
Runs faster on Linux than C# -> I mean seriously, Java's biggest advertised feature was multi-platform support while we know that Redmond guys don't care about other platforms too much.
I feel like you are trying to justify Scala by comparing it to other languages and picking a feature or property of those languages that is the worst or almost the worst.
How about this:
- Scala has such a nice type system that it blows out OCaml from the water - Scala running faster on Linux than C++
etc.
I would expect honesty when it comes to using languages that would drive this twisted and wicked developer world to something better. If we keep using the worst languages to compare to we are not going to improve. This is what I think.
How about this:
Scala doesn't - quite - have the safety and conciseness of Haskell. But it's close.
Scala doesn't - quite - have the enterprise support and tooling infrastructure (monitoring/instrumentation, profiling, debugging, IDEs, library ecosystem) that Java does. But it's close.
Scala doesn't - quite - have the clarity of Python. But it's close.
Scala doesn't - quite - have the performance of C++. But it's close.
I don't doubt your sincerity.
Try to pull yourself out and understand it as an investor:
$500 a day to pay for a scala engineer. Not a word about the bottom line.
Python? Ruby? Are they algorithmically fast? No, but they ship and sell.
> $500 a day to pay for a scala engineer. Not a word about the bottom line.
Maybe - I don't make that much and I have 5 years' Scala experience. (I have a relaxed environment and great culture though, so I'm not complaining). What I really don't get is Java companies where developers are chomping at the bit to use Scala and management says no - your devs are volunteering to become devs that companies would pay 2x for, the least you can do is let them.
The last major version and the next major version don't ship with any new feature at all, and removing some stuff, so it's a bit hard to see were you are coming from.
Python has PEP's. C and C++ have a ISO standards body. JDK has JEP. Adding a new library feature, let alone overhauling core types, is something scala added as if it was no big deal.
In python, when "new classes" were introduced, it was a big honking deal! You can bet it was heard about everywhere, in the documentation, etc. cpython interpreters like python 2.6 have support going back 5 years, and the changes between 2.x python versions are small compared scala.
There's a reason why enterprise languages move like a toad. We can't have legacy systems breaking. We want our legacy libraries to keep working. In 2015, I write python 2.6 code that works in python 3.5-dev, because they carefully planned releases and I write idiomatically.
Ask yourself if uninitiated generalist prorgammers can really grasp those hieroglyphic walls of text. It's encoding too much information too densely, and inside the density, there's so many clever tricks that block could doing.
It entices solipsistic programming. Long evenings and hard work goes into programming blocks of logic that aren't portable or readable as a future consolidation. This is where scala user's get protective. Their mental thought is legitimate, the output however means nothing to fellow coders.
With java, you could say we satisfy the longterm code quality. Even though I'm cynical of the JVM, I realize that my time and effort would hold out on the long term and my team would have code that would be a legacy into the future.
With scala, their is a sense of urgency coupled with a legitimate sense of eureka! But it all ends up looking like schizophrenic scribbling on a napkin to others.
Scala must limit the grammar in your programming language.
Did you even read the link you posted? It supports what I said.
You keep writing walls of text which are either wrong or don't relate to the topic at hand. Many of the mistakes should be obvious to a person who has used Scala for more than 5 minutes, so I'm really wondering what's your issue here ...
Not liking Scala is perfectly fine. It's not necessary to make up claims (which don't hold up to 5 seconds of scrutiny).
Edit: Instead of editing you post trying to evoke a more emotional response from people, why not focus on correcting your false claims?
To summarize: Scala to me is just a better Java with too many trade offs.
> they realized that almost all of the features are available
Interesting too. Looking at the stuff I'm currently doing, there is plenty of stuff which is just impossible in Java.
By the way, isn't "Scala has such a nice type system that it blows out OCaml from the water" already the case?
Scala was that at first. Arguably that's still Typesafe's primary interest.
> By the way, isn't "Scala has such a nice type system that it blows out OCaml from the water" already the case?
Yes and no. It's more featureful (higher-kinded types are really nice), but less elegant and type inference works less well (in part because scala has both inheritance and typeclasses).
If you're treating Scala as "just a better Java" then you're not writing inefficient code; you're writing code that could be better Scala code but is still better than the Java you would otherwise have written. Even if you never move beyond the "Java without semicolons" stage, hey, it saved you writing all those semicolons.
But Scala absolutely is a full language and not just a better Java; Java 8 barely scratches the surface of what you can do in Scala. I don't think I could bear to work in a language without higher-kinded types again.
Kafka has some very particular constraints that I don't think apply in general; remember they're making a framework rather than an application.
The harder something was to succeed at, the harder you'll try to convince yourself it wasn't wasted effort.
I started learning Scala (it got me into functional programming) but dumped it for the same reasons as Java. It's bloated. I also question Scala's longevity.
I'm happily using Elixir and Clojure these days, but I mainly do web stuff so YMMV.
Elixir as a language may or may not last. I'm betting it will, but even if it doesn't, it works well with Erlang which is going nowhere.
There's more a case against Clojure, granted. I think because Scala is seen as a bridge language is the another reason why it won't last.
Also the compiler drama... http://www.infoq.com/news/2014/09/scala-compiler-forks
Some time ago people complained that Scala had only one compiler ... so now they complain about the opposite?
I suspect the "they" that are complaining now about multiple compilers are mostly not the same people that were complaining about one compiler previously.
https://news.ycombinator.com/item?id=7458588
edit : typo
Random annoyances off the top of my head - you can't necessarily understand an isolated function unless you know what implicits are being used, crazy overuse of operator overloading and slow compilation times (this has improved over the years).
You don't have to learn Scala, you could learn Clojure, F#, OCaml or Haskell. They would all teach you interesting aspects of programming and then you could come back and examine Scala with a broader perspective.
Anyway, scala needs less weird operators, not more. Looking at you, parser combinator library.
F# might not be the best place to go then:
http://stackoverflow.com/questions/2210854/can-you-define-yo...
https://msdn.microsoft.com/en-us/library/dd233204.aspx
https://bitbucket.org/fparsec/main/src/c234349e7b738e09a1b9e...
There should be a linter for whatever IDE you happen to be using.
You might also want to look at this excellent talk titled 'Toward a Safer Scala' at https://docs.google.com/presentation/d/1tCmphnyP3F5WUtd1iNLu... that recommends a number of best practices that can be followed using Scala.
If you're using sbt, I put together a giter8 template for scala/sbt projects that follows these best practice recommendations at https://github.com/hohonuuli/basicscala.g8
One of my pet hates in C++ was implicit casting and I'm hearing that Scala does similar, which is putting me off it.
To my mind Scala is a very unmagic language; very complex libraries are written for it, but they're never magic, they're always ordinary Scala code and ordinary Scala features, just combined in clever ways. E.g. typeclasses are a language feature in Haskell, but in Scala they're just a pattern that you implement using implicit parameters. Actors and messages are a language feature in Erlang, but in Scala they're just a library with methods that you call. Type-level functions are a language feature in e.g. Idris, but in Scala (e.g. Shapeless) they're just a technique making use of implicit resolution.
When I used to work like that, I'd write code, and constantly be checking that it compiled. I'd be watching my test dashboard and feel happy turning the lights green. But it was definitely a crutch.
If you asked me to code without a compiler I'd make basic syntax errors. I'd let basic, predicable bugs slip through because they weren't covered by my tests. In my rush to turn the next light green, I wasn't thinking enough.
Maybe that's not how you work, but if it is, try building once a day and turning syntax highlighting off for a couple weeks. For me, (being forced to) work like that for a while has helped me long term.
spray-json is quite possibly the best JSON library I've ever seen, in any language.
That said, nothing does exactly what Scala does. Fluently mixing imperative, lazy, OO and functional styles isn't really common. Neither is the wealth of concurrency constructs available to Scala programmers through the standard library and Akka.
I'm writing a compiler in (not for) Scala right now and it's pretty sweet.
This is not true.
If you find yourself in the future "hating" all the programming languages, this isn't necessarily problematic, it might just mean you have a good understanding of programming languages. Just try to remain polite and remember that there's more than one way to see most scenarios.
My intent was to imply that since jython is a python implementation, the language itself is more widely 'accepted'. Where accepted may mean "in general use and considered to be a good langauge". Groovy has been called a better java by some. Another example would be JRuby.
[1] http://en.wikipedia.org/wiki/Principle_of_charity
Your intended meaning requires a big leap in what side spread acceptance means, so I hope you can see the confusion.
I have only dabbled in Scala myself, kicked the tyres as it were. My question was, is this an Ocaml or Haskell with good interop with the Java ecosystem? The answer is no but I don't hate Scala for it, I just moved on. But many folks would have persisted and tried to make it into something it's not and gotten miserable in the process.
Just like how people won't touch Python because of its whitespace, people won't touch Scala because of the JVM.
It can be -- and is -- for some people.
> Actually, being JVM-compatible is an attraction point.
Sure, for some people. People have different preferences.
1. The REPL is not very helpful: You cannot look up documentation a la IPython (i.e. myFunc?) or inspect objects easily to find out how things work
2. There always seem to be 10 ways to do the same thing. This makes it much harder to understand other people's code than when there is just one way to do it.
3. The type system seems less helpful than Haskell's (e.g. why is "asdf" + 3 not a type error?)
The antithesis is when we see posts about how "Go's too simple".
"One could also argue that this provides evidence of simplicity" Or one could argue that it provides evidence of complexity, since you need to hold much more information in your head to achieve the same results.
I'm not sure I've seen any "Python's too simple" posts. Maybe Go's criticism is based on some other factor?
3. Some of these are backwards compatibility. You can get a more helpful typesystem by setting a few flags: https://tpolecat.github.io/2014/04/11/scalac-flags.html
There might be valid criticism, but to me your comment doesn't make a good job bringing the "stretch marks" across ...
I get the sense the Java community is also unused to interacting with other languages, because for a long time the JVM was a world unto itself. Most languages have a spectrum of "neighbour" languages and so users are used to working with at least slightly different alternatives. Scala is possibly Java's closest neighbour (Groovy is not really popular enough to show up on the radar of most Java devs) and it's become something very different, so there's a real culture shock just trying to talk to each other. A lot of Scala folks take a lot of assumptions for granted that are very alien to Java folks.
None of which really takes away from the language itself, if you're willing to learn on your own or tolerate a few insults when you ask for help. IMO it is very much worth it: Scala is genuinely the best practical language available today (it has more than its fair share of warts but they're mostly for JVM/Java compatibility, which makes it so much easier to introduce to business than e.g. Haskell).
For example gradle buildscripts are groovy, as is the spock test framework.
You can read the other unemployed developer's take on Groovy's development history at http://blackdragsview.blogspot.com/2015/04/about-being-paid-...
What turns be off from looking into it much:
Verbosity. It seems that it can't infer types in as many places as an ML. I prefer rather succinct code. I understand Scala has a powerful type system and it isn't always possible, but... ugh.
OO. Scala seems to want to really embrace Java's OO model fully, and that's a bit ugly. It's probably a good practical decision but feels like a turn off. Again, I haven't used Scala, this is just an impression I have.
Scala is, by definition, a superset of Java. It's not ideal, but there aren't really any good alternatives.
I think the problem is that Hindley-Milner type inference doesn't play with OO type hierarchies, and so Java interop (which is a key motivating purpose of Scala) means worse inference than ML-family langs for Scala. Its not really that its a powerful type system that is the issue (Haskell has a more powerful type system, but better inference.)
> OO. Scala seems to want to really embrace Java's OO model fully, and that's a bit ugly.
I think "embrace" is a bit strong, but it wants to support it fully, because its a key part of the interop story.
It's a very powerful and expressive language. That translates to "completely unreadable by people without at least a few months direct experience in it." If you plan on introducing people with little to no scala experience to your code base regularly you will probably want a different language or to severely limit your allowed feature set.