Live data from Hacker News

Ask HN: Java 8 or Scala?

news.ycombinator.com

31–39 of 39 posts

Re: Ask HN: Java 8 or Scala?

#31
post #19

Earlier quoted context omitted.

What would you recommend instead?

For a website? Why scala? Because LinkedIn and Twitter use it? I have had great experience with Django in the past 8 years. Nice tooling. Nice template engine. Nice ORM. Mature. Scalable. Robust. The main detractor you'll hear about it is performance. You're just building a website. Even in situations where I'm recompiling LESS (bootstrap), with all debug tools on, and rendering images in the same pageload, it takes…

Account-created-2-hours-ago, did you ever use Scala, or are you just trying to troll (badly)? :-)

Edit: Oh, right. After reading your other comments, it's obvious that you haven't used Scala.

Re: Ask HN: Java 8 or Scala?

#32
If your team is open to learning new things and comfortable with the occasional bout of feeling lost, then Scala is absolutely the better choice. The advantages of Scala is not it's lack of verbosity primarily, (Ceylon, Kotlin, F#, etc. are all similar in verbosity) but its support for functional programming. And I should add that 'lambdas' do not make a language functional, imho.

Scala's focus on immutability (case classes, std lib), monadic comprehension (for expressions), type class support etc. all make it a joy to be productive in. But it also has proper lambdas that just work right (Java8s lambdas are done poorly for sake of backwards compatibility).

You'll find less of a need to rely on frameworks (DI is trivial with just language features, you learn them once, you're good, no spring needed), you'll have less bugs, and it will be more fun!

Reasons not to use Scala would be the lack of tooling (you're IDE will annoy you more than if you pick java), your team may get frustrated at times and need to ask the mailing list or IRC channel for help, and new developers who don't have scala experience will need a bit more handholding.

We're finding for some cases we get a 100x LOC reduction coming from C#. This is not a joke, and it's not about us writing extra terse impossible to read scala and fitting too much on one line. The type system just allows us to reuse a few abstractions EVERYWHERE. We are getting insane code reuse, even between teams.

Re: Ask HN: Java 8 or Scala?

#33

From my experience, Java while more verbose offers better tooling, standards, documentation and support. Scala certainly is more concise but there is a cost that you will incur later when trying to debug or maintain s large fast moving code base. Sbt blows, ide support for scala is spotty and good luck defining a code convention and standard that you can automatically lint and format. To me it's c++ for the jvm (not…

I tried ScalaIDE once and I hated it. I've also used the IntelliJ plugin for Scala and it was a pleasant experience. Would you explain what you're missing with the IntelliJ plugin?

I agree. Intellij and Scala work very well together.

Re: Ask HN: Java 8 or Scala?

#34
In my personal experience, Java 8 is a safe bet. Yes, it is more verbose which I don't like either. If you avoid the over engineered frameworks in Java-land its not that bad. You mentioned Play, which as others have pointed out is a Scala first framework. I prefer modern Java frameworks like Dropwizard or Vertx.

I tried to evaluate Scala after getting to know some basics & was thrilled at how concise code becomes in Scala vs Java. However, Scala does have a steep learning curve. I found that there were many different ways of implementing the same thing, which is time consuming in the beginning. There is opinion that it pays off later, I was not able to get to that stage because of initial impediments.

As somebody else mentioned, using Spark API in Scala was a joy. Same code in Java becomes several times more verbose.

At the end of the day you need to evaluate your team & develop a consensus. Your team might have some valuable opinions too.

Re: Ask HN: Java 8 or Scala?

#35
post #32

If your team is open to learning new things and comfortable with the occasional bout of feeling lost, then Scala is absolutely the better choice. The advantages of Scala is not it's lack of verbosity primarily, (Ceylon, Kotlin, F#, etc. are all similar in verbosity) but its support for functional programming. And I should add that 'lambdas' do not make a language functional, imho. Scala's focus on immutability (case…

I code Scala in IntelliJ and it's an absolute pleasure :-)

Re: Ask HN: Java 8 or Scala?

#36
post #32

If your team is open to learning new things and comfortable with the occasional bout of feeling lost, then Scala is absolutely the better choice. The advantages of Scala is not it's lack of verbosity primarily, (Ceylon, Kotlin, F#, etc. are all similar in verbosity) but its support for functional programming. And I should add that 'lambdas' do not make a language functional, imho. Scala's focus on immutability (case…

You mentioned fewer bugs, and indeed I feel that Scala is safer than Java (fewer bugs). Some reasons: 1) Scala has named parameters, so you can avoid bugs related to parameters placed in the wrong order (simply specify the parameter name, if you have more than one of the same type). And 2) when you code in Java, you'll have to read and write more code = higher bug risk. (But I wouldn't want to write super concise code in Scala, that could also mean higher bug risk.) And 3) Scala doesn't suffer from null pointer errors (assuming you use Option/Some/None). Java also has some Option class but I've gotten the impression that people tend not to use it.

Scala has the best collections package I've ever seen in any language so far.

Re: Ask HN: Java 8 or Scala?

#37
post #35
post #32

If your team is open to learning new things and comfortable with the occasional bout of feeling lost, then Scala is absolutely the better choice. The advantages of Scala is not it's lack of verbosity primarily, (Ceylon, Kotlin, F#, etc. are all similar in verbosity) but its support for functional programming. And I should add that 'lambdas' do not make a language functional, imho. Scala's focus on immutability (case…

I code Scala in IntelliJ and it's an absolute pleasure :-)

Agreed. I'm using IntelliJ Community Edition with Scala plugin. It works really well. Only settings I've changed were setting the font to Source Code Pro and turning off spell checking.

I'm absolutely loving Scala right now. I was writing a lot of stuff in Go until I started a new project that needed to leverage some Java libs. I had been wanting to try Scala, so I went with it instead of Java (or Clojure, etc).

I liked Go for it's elegant concurrency, ease of deployment, and fast compiler, but Scala's type system and composition with for comprehensions is really nice.

Java interop is pretty seamless so far. Scala has nice primitives for wrapping null and exceptions in safer ways and eliminates a lot of ugly x != null checks everywhere.

Coming into it, I'd heard that Scala was hard to learn, but I didn't find that to be true. I was only vaguely familiar with pattern matching, monads, traits, ADTs, etc from playing with Rust, but I found plenty of good resources for learning Scala.

I really found this series of blog posts to be helpful: http://danielwestheide.com/scala/neophytes.html

Re: Ask HN: Java 8 or Scala?

#39
post #17

Java is the right choice. Before I get into that, you may want to not focus on the framework so much, at least not before you choose the language! Scala is great for the right purpose, it's powerful and should make you productive much faster. Yes, Scala is much less verbose which seems like it would be much more efficient. Enter one Scala developer who has small stylistic inconsistencies and you have set everyone bac…

Doesn't Play have documentation / API for Java?

It's amusing that your user name includes the word "Scala". Sounds like you already picked a side...
Post reply on HN