Hacker News new | ask | show | jobs
by pkulak 4930 days ago
As far as I know, Scala can't give you _better_ performance than Java, but I also can't see it being too far off.

I've never really seen the benefits of Scala. Everyone whines about Java syntax, but it's really not that bad. Verbose, sure, but it just doesn't seem like time spent typing is where my productivity goes. Maybe I'm just getting old, but I no longer care about language syntax as much as I used to. A preprocessor to give me Java 8 lambda syntax would probably solve all the issues I have with Java right now.

4 comments

"A preprocessor to give me Java 8 lambda syntax would probably solve all the issues I have with Java right now."

That's one of the things that Scala gives you: the functional features are there now and have been for almost ten years.

Still, I know where you're coming from. I was a die-hard Java guy until I gave Scala a shot. I'm not looking back, though I do think that Java's tooling is much more mature than Scala's.

Scala has much worse tooling (SBT is an oxymoron), and it's much harder to read than Java.

Conceding that it's more fun to write, I think 'harder to read' is more important. Scaling refers to team size and amount of functionality in addition to requests per second.

The "much harder to read" varies greatly between codebases. Most "sane" codebases are 90% (random percentage) as easy to read as Java. Just collection initialization, transformations, simple pattern-matching, method invocations... Some times there is an ugly nested flatMaps/maps/filters. But in my experience, in general, they're more the exception than the rule.
It's also the slowest compilation I've ever seen, even with really clever custom tooling.
Scala compilation is indeed slow (although I think C++ is worse). But I always have a "sbt ~compile" running, compiling every file as they change. So the compilation time is pretty much irrelevant to me. While using eclipse, I guess, you'd get the same speed too.
I didn't either, until I tried it. On one level, yes, it's java with type inference and lambdas and saves you typing. When you dig a little deeper in scala, things like case classes (immutability), pattern matching, for comprehension (monad syntax) suddenly fundamentally change the way you program.

Code becomes a lot more clear, explicit, and... fun. I recently talked to a dev who used Akka with java for a network server, and he ended up coding it in 'an object for each callback handler' style.

When I asked why he did it that way, he said nesting callbacks to sequence operations would get too ugly fast.

This is trivial in scala. The language flaws in java ended up dictating the architecture of his entire application, and for the worse IMO.

"A preprocessor to give me Java 8 lambda syntax would probably solve all the issues I have with Java right now." Xtend seems to do this and more http://blog.efftinge.de/2012/12/java-8-vs-xtend.html
I think the benefit is that people don't want to say they're Java programmers. It's like a hipster thing. Most modern scala programmers don't even use the language correctly, or couldn't write "hello world" if it wasn't in the play framework.
I think you mistook HN for YouTube.
He raised a point, though a little abrasively. You left an entirely content-free response. Who mistook what for what again?

Attack his point and win, instead of pointless drivel like this.