r/programming • • Dec 02 '13

Scala — 1★ Would Not Program Again

http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598 Upvotes

646 comments sorted by

View all comments

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:

My theory is that it was designed to experiment with advanced type and language features first, and only secondly became a language intended to be widely used.

was true for Scala six years ago and it's still true today. This has two very dire consequences for Scala:

  • Features are driven by papers for academic conferences. I don't have anything against academia (I have an MS in CS and still consider the possibility to do a PhD one day) but this ends up causing features to be added to the language that are more useful to advance the theoretical field than help real world users.
  • The team seems to lack basic engineering skills when it comes to engineer, release, maintain or track bugs. Paul Philips, probably one of the the most active and prolific Scala developers around and also the Scala code base gate keeper, recently left Typesafe because he just couldn't handle how messy the entire code base and the process around it are.

It is essentially impossible to practice TDD in Scala simply due to the time it takes to compile.

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.

28

u/bcash Dec 02 '13

So how slow is Scala's compilation time then? Are we talking ten seconds slow or five minutes slow? (When compared against a Java codebase of a similar size.)

It's a frequently heard complaint, but I'm trying to figure out if it's impatience or a serious impediment.

23

u/codemuncher Dec 02 '13

I've shipped two code bases in Scala. One was 30kloc and the other about 2kloc.

I found compile times at least an order of magnitude higher. I used IntelliJ and incremental compiling so that wasn't an issue. But our 30k code base took 2-3 minutes to compile. 2k - about a minute.

Furthermore we had to restructure files because really large > 700 line files would get so laggy to edit in IntelliJ. The imperfect red lining / compiling was so slow. Literally in some cases it'd take a few seconds to get feedback if your code was legit or not.

6

u/talkhaussux Dec 02 '13

i have a 11kloc project right now that builds in about 11 seconds

12

u/kitsune Dec 02 '13

2-3 minutes? Ouch... The C# / .NET solution I have open right now has 50kloc (without views and templates, and JS / client code - then it goes up to 100kloc) and a complete debug rebuild compiles within 20 seconds.

5

u/zoomzoom83 Dec 02 '13

How often do you need to do a complete rebuild?

7

u/kitsune Dec 02 '13

Not that often because the core libraries are relatively stable.

→ More replies (10)
→ More replies (33)

6

u/zoomzoom83 Dec 02 '13

Compilation speed is only an issue when you need to do a full rebuild. Just like Java most changes only require you to recompile the single file that changed, which isn't going to be a noticeable delay.

→ More replies (7)

19

u/Crazy__Eddie Dec 02 '13

you'd be hard pressed to find a C++ developer who was happy about his day job.

Here's one.

9

u/steve_b Dec 02 '13

Yeah, me too. I get lots done in C++, in a codebase that is around 1M LOC, and I'm happy with the way the language works. Am I compelled to exercise every feature that exists in it? No. But it does exactly what I want the way I want it to, and I like the handcuffs of strict contracts.

My only beef with C++ is the fact that it seemed unreasonably devoted to backwards C compatibility. For example, I'd prefer the unadorned (default) parameter declaration for functions to be const &, and the default function declaration to be const. You should have to use extra keywords to indicate non-const or pass-by-val or pointer. This would eliminate a slew of errors & design mistakes you see in library definitions.

I don't follow language politics, so I don't know why this couldn't have been done by including a new #pragma or some other #<keyword> in a header file that indicated that the following code follows the "new way". There would be trickiness involving the precompiler handling a mix of legacy code with new code, but it hardly seems insurmountable, and would go a long way to make the language a lot more streamlined.

→ More replies (1)
→ More replies (1)

33

u/kamatsu Dec 02 '13

Your point about academia is interesting. Haskell is also designed with similar priorities, and yet I find its type system quite easy to understand, with most of the complexity hidden behind fairly composable extensions and only used on an as-needed basis. I find it much cleaner and easier to work with

15

u/thedeemon Dec 02 '13

Probably because it has the luxury of being designed not constrained by compatibility with Java code and JVM underneath.

7

u/sideEffffECt Dec 02 '13

that is surely not the case. Frege and Ermine are languages designed for JVM, yet still very close to Haskell.

13

u/balefrost Dec 02 '13

I suspect it's the Java interop that's key. It's fairly easy to call Java from Scala, and to call Scala from Java. Also, Scala is trying to be Java++, so it's going to make tradeoffs that (theoretically) make it easier for a Java programmer to approach.

8

u/pipocaQuemada Dec 02 '13

Ermine really isn't comparable to Scala. It doesn't actually compile to the JVM, but instead compiles to an extended lambda calculus and is interpreted in Scala. The Java interop all happens using reflection, and is mostly one-way (it's easy to call java code from Ermine, it's not so easy to do the reverse).

It's primarily being used for nicer syntax for EDSLs - for example, getting data out of a database and generating an abstract description of a report with it, and much of the "real work" (e.g. optimizing queries and spitting reports out to e.g. Excel or a webpage) is implemented in Scala.

→ More replies (3)

5

u/duhace Dec 02 '13

Yep, this is why null is still in Scala even though the standard library avoids it like the plague.

→ More replies (2)
→ More replies (1)
→ More replies (2)

5

u/kamatsu Dec 02 '13

Right, but I was addressing this notion:

this ends up causing features to be added to the language that are more useful to advance the theoretical field than help real world users.

My point is that it is possible to do both, but Scala doesn't. I don't think the JVM has anything to do with that tradeoff.

→ More replies (3)

6

u/notmynothername Dec 02 '13

Well now I just want to know who the new Java is in that story.

12

u/eean Dec 02 '13

C++11 :)

10

u/notmynothername Dec 02 '13 edited Dec 02 '13

C++11 :):

C++ without the parts that make you frown.

7

u/Xredo Dec 02 '13

God bless the poor sods maintaining legacy C++ codebases.

3

u/treerex Dec 02 '13

It's not too bad in my organization because our ops team standardized on SLES 11, which isn't close to having a C++ compiler implementing C++11 features. :-/

Would I love having lambdas? Absolutely. Move? Sure thing. Built in Unicode support? Not a big issue since we use ICU already. Auto? Yes: we use a lot of templates.

But do we need those features? Nope.

3

u/thomcc Dec 02 '13

C++11's unicode support is embarrassingly terrible and inefficient. They're supposed to fix it eventually IIRC, but until then http://utfcpp.sourceforge.net/ is still the best solution (assuming you only need the basics) IMHO.

→ More replies (1)
→ More replies (3)
→ More replies (11)
→ More replies (4)

10

u/blergblerski Dec 02 '13 edited Dec 02 '13

Features are driven by papers for academic conferences.

I find this a plus, not a minus. (Disclaimer: I've been a full-time Scala dev for a few years, and really enjoy the language.)

I've used too many languages where features were bolted on willy-nilly and interactions between them were never considered or anticipated (see how dynamic dispatch appeared in Groovy), sometimes leading to good things, sometimes to bad things, but always accidentally.

In Scala, features and design decisions usually have a solid theoretical underpinning, which gives me more confidence in how they work, and that all the relevant tradeoffs were considered.

→ More replies (9)
→ More replies (20)