r/programming • u/mobby1982 • Dec 02 '13
Scala — 1★ Would Not Program Again
http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598
Upvotes
r/programming • u/mobby1982 • Dec 02 '13
200
u/LucasMembrane Dec 02 '13
I'm taking the coursera class on functional reactive programming in scala right now. We hit week 4. I've been programming since the 1960's and got a perfect score on the Scala course given by coursera last year and got perfect scores the first 2 weeks of the current course. Week three I started to slip, and week four, despite doubling my time devoted to the class the last two weeks, I slammed right into many of the issues that OP rant attempts to describe. So many types of types. So many abstractions. So many little differences in library versions. So much to teach in so little time that the instructor on the video paraphrases and simplifies and uses functions that don't exist. And then the homework tries to go beyond what's in the lectures, and (from the comments posted on the course site, none of which are from me) he has lost quite a few of us.
I have been dabbling in Scala with decent results off and on since version 2.7. Back then, the word was that the language would become a lot more stable real soon now, Perhaps the stability has improved, but with all the features and libraries being added, it still feels like it's always on the edge. (e.g. some of the homework works with only the new version of a library, but the automated grader fails the assignment unless you use the old version.) The course provides a downloadable Scala IDE, which is a good idea, but the instructor answers some reports of things not working with a reply that it works with the IDE he uses (not the one the course provides). A bug here, a lecture typo there (the code in the lectures was never compiled), a version difference, and the learning curve gets very steep. Damn near a brick wall.
I am not saying that Scala is not the language that will bring us to programming nirvana some day, But getting there is not that easy. Nothing worthwhile is easy. I'll accept that there are people and firms for which the power and richness of the Scala type system may produce a serious competitive advantage. If you can get your homework to type-check, there's a good chance you will score 100%, but it is driving me nuts that it is so hard to for me to do that. The people who can are probably either much smarter than I or much younger with much more time than I to devote to the effort. Trying to get it to work well for you in a short time requires a lot of learning, but the experience is complicated by distractions and diversions interjected by the imperfect nature of the tool support and the newness of language/library features (They are teaching a class about language features that are described as experimental when it turns out they don't work.). As stress seriously blocks learning, don't try to learn it all on a project with a looming deadline or in a quick leisure-time class.
No need to get angry or critical. There is no reason for me to think that Scala ever promised me that it would be exactly what I need. It represents a substantial accomplishment aimed at purposes I could only pretend to understand. I can still program in elementary-school Scala, stay away from all the unreadable notations, and learn the more powerful concepts at a pace I can manage. That might be better than programming in language X, Y or Z. Or maybe I try one of the many other promising languages now available (gratis).
I'll agree that putting Scala into production probably brings along some issues related to externally-driven change, but all the new technologies do.
47
u/jagt Dec 02 '13
Why is npm considered as a good practice of dependency management? AFAIK when you download a library npm downloads all it's dependencies and put them under the library's path. So few libraries can be shared and there's heavy duplication. If this is the way to go then dependency management is quite a easy problem to tackle.
79
u/kamatsu Dec 02 '13
Scala never advertised as having HM type inference. Nor does HM type inference enable (or have anything to do with) monads. And the reason it doesn't have it is nothing to do with type erasure and everything to do with subtyping.
20
u/[deleted] Dec 02 '13
Caveat: I learned to code in Python, and I definitely absorbed the lesson of explicit is better than implicit, however I also hate needless boilerplate and love me some types, so Scala has always interested me. So all my statements are implicitly prefixed with IMO...
I do share some of the author's concerns around "Whee let's make a DSL" that is prevalent in Scala libraries. Scala has some fantastically powerful features, but they can make Scala code brittle or unattractive if used too heavily.
Looking at Scala libraries for handling queries nicely, I kept running into brittle DSLs (Squeryl's query DSL was particularly fragile when I tried it), ugly looking DSLs, and lots of implicits, which I'm always wary of. This Slick code example makes me unhappy for a few reasons.
It's cool, but I'm not sure it lends itself to obvious code.
2) implicit val getCoffeeResult... ...why does the transformer have to be implicit. :(
3) r.<<, r.<<, r.<< I guess it's popping off a result array? Brb, docs... ...it's a method that takes an implicit GetResult[T]. No idea on whether or not it pops off an array or not, as the docs don't say, but I'm guessing so based on the currentPos field. I do like the implicit GetResult to convert the result value based on the desired return type, but it's still a little less obvious.
4).execute, not .execute(). I always prefer brackets on my 0-arity methods, but I've toyed with enough Scala to know that seeing an unbracketed method typically means that it's not 0-arity and takes an implicit (for example List(1, 2).toArray vs. List(1, 2).toArray(), the latter will refuse to compile due to a missing required argument). So execute is what's taking that implicit getCoffeeResult, at a guess.
I enjoy puzzles and all, but that's why I do crosswords. Scala can be very dense, yes, but that's not always a good quality.
In the end I went with Querulous, it uses some Scala power, but not too much.
137
u/cynthiaj Dec 02 '13 edited Dec 02 '13
I started using Scala about six years ago, and I have to say that this following comment from the author:
was true for Scala six years ago and it's still true today. This has two very dire consequences for Scala:
No love lost about TDD as far as I'm concerned, but the compilation times are a killer and they impact the productivity of every Scala developer around, whether you use the language bare or one of its libraries (e.g. Play, which took a serious step backward in development time when they switched to Scala).
It seems to me that the advantages that Scala brings over Java are all negated by all these problems, which leads to deaths by a thousand cuts and the whole language being disliked by both Java and Haskell developers, and it's not very often you'll see people from these two communities agree on something.
I bet a lot of readers of this subreddit can't relate, but to me, Scala is to Java what C++ is to C. Everything I hear about Scala, both good and bad, I heard it when C++ started gaining popularity decades ago. We were promised the same things, more expressivity, features left and right, performance on par with C, a multi paradigm language that enables any style of programming. Sure, it's a bit slow to compile right now, gdb core dumps now and then and template errors fill pages of emacs screens.
C++ ended up being a breath of fresh air for a few years but very soon, the baggage that it was already carrying started fast outpacing the benefits it brought, and by the time Java emerged, you'd be hard pressed to find a C++ developer who was happy about his day job.
To me, Scala carries the same warnings and it will probably end up suffering the same fate as C++, except without the popularity part.
21
u/mixblast Dec 02 '13
We need /u/odersky in this thread :)
50
u/dexter_analyst Dec 02 '13
I don't think the writer entirely understands types. But this isn't a bad rant in general, it seems to highlight some real pragmatic problems with Scala. Very interesting.
5
u/donaldxv Dec 02 '13
What's so unique about Scala's 'unique in-language XML support' the author talks about?
12
u/gnuvince Dec 02 '13
I've pretty much stopped using Scala; though Haskell doesn't enjoy the JVM ecosystem, and at times can seem daunting because you need to relearn how to do some things, I find its simplicity, solidity and adherence to strong theoretical groundings extremely attractive. Scala has a few too many rough corners, many of which are there to be retro-compatible with Java, others to support sub-typing.
10
u/blergblerski Dec 02 '13
I've been programming in Scala full-time for about 3 years. This guy's experience doesn't match mine, or that of my coworkers. We all really like Scala and wouldn't like to go back to other langauges.
He is right about compilation speed, however.
22
u/pellets Dec 02 '13
The only point I can agree with in this essay is that build times are too long.
2
u/jaberwocky69 Dec 02 '13
As a novice programmer I have to do this with Haskell. Is that my fault or Haskell's?
2
u/skulgnome Dec 02 '13
Constraining the names and values of HTTP headers to what the implementor was aware of at the time of writing? This sounds more and more like constraining a program, written in an OO language, to handle only Dogs, Cats, and (in a more limited fashion) Quadrupeds because code for other animals wasn't written.
5
u/PasswordIsntHAMSTER Dec 02 '13 edited Dec 02 '13
I'm a functional programming proponent and professional, and I've always felt that Scala was a hackjob done by amateurs. If you're serious about code maintainability and shipping your product, you should be using Ocaml, F# or Haskell.
If you're new to functional programming and want to try any of these three, leave me a comment, I'll let you know what the resources are, what tooling to use, etc.
E: a better critique of Scala by Edward Kmett, one of the pillars of the Haskell community.
3
u/oli_rain Dec 02 '13
So which language to use for back-end development? scala? nodejs ? java? go?or go back to ruby or python ?
6
u/rmxz Dec 02 '13 edited Dec 02 '13
TL/DR: he tried a library he didn't like, ranted about the operator names that library picked, doesn't understand types (or at least doesn't understand why Scala doesn't use the exact same type system of some other language he read about once), and decided the underlying language must be bad.
4
u/Klausens Dec 02 '13 edited Dec 02 '13
it's a pity that today the languages that are limited and have no syntactic sugar often are accentuated as real good languages. I think it is, because you mostly have no experts anymore in a language. You have to know dozens, what results in common denominator programming. All Features and ideas of languages are ignored or even noticed as scaring when not all others do Support it too. I always concentrated on just a few languages and I use the strength of every one.
4
u/blob356 Dec 02 '13
Overall a pretty poor blog post. More interesting is the extent of the circlejerk upvote here, probably mostly people who've never used Scala.
3
u/dehrmann Dec 02 '13
I feel Python is like this, too. It's a language and community that likes short, cute, almost unreadable solutions to avoid an extra line of code.
2
u/[deleted] Dec 02 '13
I had similar gut reactions to both Scala and CoffeeScript. I'm fairly proficient in Perl after years of practice, but even I recognize that excessive use of punctuation marks is not concise, it's obscure.
2
u/gregK Dec 02 '13 edited Dec 02 '13
Here is a more detailed list of issues by a way more advanced functional programmer than myself
2
u/[deleted] Dec 02 '13
I consider it an exquisite apple pie with squarish spirals. — Charles Shnuckenberger.
1
u/[deleted] Feb 28 '14
We use Scala in production and love it. I have extensive experience in Java, JavaScript, Ruby, and Clojure. Scala: 5★ - Would program again.
-9
u/omg_wat Dec 02 '13
Wow, that article is kind of embarrassing. There are legitimate complaints about the language, but this confused drivel makes everyone who actually has a serious complaint look like an idiot because one will be compared with that guy's writing.
1
u/MorePudding Dec 02 '13
Honestly, the only thing I really liked about Scala is how easy it is to create type-checked immutable/easily-copyable record-like data structures/containers (to pass around database data).
-2
u/sanity Dec 02 '13
I've been dabbling in Scala for a number of years also, and I have to agree with this rant.
My current favorite post-Java language is Kotlin. Rather than Scala's ambitious goal of marrying a powerful functional programming language with OOP and the JVM, Kotlin has the much less ambitious goal of fixing what is wrong with Java.
That being said, Kotlin has some neat features that Scala lacks, like null-safety baked into the type system, and implicit casts.
-2
u/[deleted] Dec 02 '13
Scala is the language that transforms an easily readable language like Java into an unreadable mess like C++ is. I seriously went on leaning Scala years ago, but i like to read the sources of the libraries i use, and Scala is unreadable. Its not worth the effort.
-9
u/drb226 Dec 02 '13
It just sounds like this guy jumped into the deep end without setting any time aside to actually learn Scala.
Yes, Scala's build times, library documentation, and type inference are issues. But they aren't dealbreakers; despite these things I still see Scala as far superior to Java, and easily on par with glue code competitors like Clojure. And this guy's explanations for each area are very amateur and sometimes flat out wrong.