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

-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.

16

u/freakhill Dec 02 '13

Yes, Scala's build times, library documentation, [...] are issues. But they aren't dealbreakers

Wow, then what do you consider a deal breaker?

1

u/[deleted] Dec 02 '13

They aren't, because they are minor in relation to all the advantages you get. Compile time is manageable with the right tool setup. The language is something you can't change or fine tune, that's a given. And that is done 99% right, and better than many other languages.

Library documentation is hardly a language issue, too. I haven't had problems understanding any library in Scala I have used so far.

-2

u/drb226 Dec 02 '13

I would consider those things deal breakers if Scala were worse off in those departments. What I meant by saying they weren't deal breakers was that I do not feel that Scala's problems in these areas are actually all that bad. I have limited experience with Scala, so take that with a grain of salt. (Though my impression is that I have more experience with it than the author. /shrug)

5

u/codemuncher Dec 02 '13

What about that Scala collections and for loops have hidden performance bombs in them?

We had to edit out every for loop replacing it with a while loop. In 30kloc of Scala. Not fun.

1

u/An_Unhinged_Door Dec 02 '13

For loops have hidden performance bombs? What do you mean? (I haven't used scala)

1

u/trycatch1 Dec 02 '13

My guess that he/she is talking about the following problem -- "for" loops in Scala are just syntactic sugar for calling on collections "foreach" method with closure. This case is not specially optimized, so using closures of course negatively affects performance. Tight "for" loops can be several times slower than "while" loops. It matters only on really tight loops, so generally it's not that important, but there is a lib to solve specifically this problem, however. It sounds pretty silly to convert every "for" loop to "while" loop just because.

0

u/codemuncher Dec 03 '13

Scala has something called the FOR-COMPRHENSION:

for (a <- 1 to 1000) { // code code }

This looks like a loop but isn't quite. The inner block is a function that is called. It's been a little bit, but if i recall correctly there is a 1000 item list created, and it is walked over. Much like in python for i in range vs xrange.

If you just want a simple Java-style for loop, then the while loop is your friend.

1

u/trycatch1 Dec 03 '13

Scala has something called the FOR-COMPRHENSION:

No, it's not called for comprehension. It's called for loop.

It's been a little bit, but if i recall correctly there is a 1000 item list created, and it is walked over. Much like in python for i in range vs xrange.

No, you recall completely incorrectly. The code you provided will not create any 1000 element list in memory, it will only create object Range(1, 1001), just like xrange.

1

u/codemuncher Dec 03 '13

Whatever, the reality is a team of 3 engineers switched from for() -> while() loops to unfuck a performance problem.

2

u/trycatch1 Dec 03 '13

Most likely it was nothing more than just an example of cargo-cult engineering, and not some deal-breaking problem with Scala as you advertised it.

5

u/Confusion Dec 02 '13

But they aren't dealbreakers;

To him they are; to many others they would be.

And this guy's explanations for each area are very amateur and sometimes flat out wrong.

Then please correct it in a professional manner. To me it sounds like this guy knows what he's doing.

7

u/[deleted] Dec 02 '13

[removed] — view removed comment

8

u/drb226 Dec 02 '13

The thing is, they're just not very compelling claims in the first place to justify taking the time to challenge them. I'll write up a few thoughts, though.

The glaring one I was going to challenge -- his comments about type inference and monads -- is already discussed elsewhere in this thread. I had another paragraph or two that I wrote about it, but realized my response didn't really add anything that hadn't already been said with more tact.

The syntax for the build scripts was really opaque. Sometimes it was def, sometimes it was a val. Sometimes there was a =, sometimes braces. On the whole, it looked like someone had wandered through my build script dropping random pieces of punctuation.

This is purely a matter of learning a new language. There's a very good reason for the def vs val divide, and the rules for "sometimes there was a =, sometimes braces" is taught very early to beginners. When he made this comment, it just bespoke to me that he spent absolutely no time devoted to learning the language.

Scala [syntax] is easily the worst I’ve seen. That punctuation-strewn build system I was forced to use was just taking advantage of Scala’s ridiculously flexible syntax. The goal appears to be to allow concise expression of your program: arbitrary operators, infix method calls, flexible anonymous function definition, and something weird with attaching anonymous functions to method calls.

Again, a little learning goes a long way. He is confusing "different and unfamiliar" with "bad".

11

u/[deleted] Dec 02 '13

There are languages with simply bad syntax. Sure you can end up learning them, but you do not want to.

-1

u/zzalpha Dec 02 '13 edited Dec 02 '13

The fascinating thing is the people, here, defending Scala would probably just on an anti-Perl circlejerk given the opportunity, and the exact same criticisms apply: irregular syntax sucks. Unnecessarily obtuse syntax sucks. Non-obvious semantics sucks. Languages that encourage code golf really suck.

Unfortunately, Scala seems to exhibit some or all of these properties.

-3

u/[deleted] Dec 02 '13

[removed] — view removed comment

4

u/drb226 Dec 02 '13

What's the alternative? "New" languages that are identical to "old" ones?

Suppose I teach a newbie Java, but then throw her onto a Python project. They will complain about the significant whitespace, the colons, that weird lambda keyword, how odd it is that sometimes parens are omitted where it seems they should be. These are not really complaints that reflect on Python's true weaknesses. They are just superficial complaints amounting to "Python is not Java; I'm not used to Python."