top | item 9057817

Ask HN: Scala usage?

9 points| muraiki | 11 years ago | reply

I'd be interested in hearing about experiences using Scala in production. I've been looking at statically typed languages lately, and although I don't have any Java experience Scala seems quite powerful, allowing a good mix of FP and OO concepts. Would it be a problem for me to try using Scala without knowing the surrounding Java ecosystem?

I know a little bit of Haskell, but in terms of industry usage it seems that Scala is more common. That being said, I don't hear about it much on HN; there seem to be more articles on Haskell, Ocaml, and Clojure than Scala.

I did find a discussion from last fall where there was a fork, and that has me concerned as the author of the fork seems to have a pretty reasonable critique of some problems in the language: https://news.ycombinator.com/item?id=8276565

In terms of my personal desire for learning this language, besides an expressive type system I'd like to have rich handling of errors (such as Maybe and Either) and a non-callback hell type of async, which it seems Scala (or at least some Scala libraries) offers. Thanks!

6 comments

order
[+] playing_colours|11 years ago|reply
I've been working at the third company where Scala is used in production. I live in a large city (Berlin), so it's not a big problem to find a job in it. Scala is more popular here than Haskell, Clojure etc. It's not that popular on HN in my opinion because it's not that sexy at the moment, has Java burden, not as clean as Haskell, not web dev focused.

Once you start writing code behind Scala tutorials, you will be exposed to Java ecosystem and JVM. Sure you don't need to learn JEE, but definitely things like Java concurrency, Maven, JDBC won't harm.

You can learn a lot from the language and infrastructure (FP, type system, Scalaz, actor-based concurrency, etc.), write critical production systems in it - there are lots of mature libraries and frameworks. There are nice new things coming - Akka Streams, Scala.js.

And don't expect Scala to become mainstream.

[+] frowaway001|11 years ago|reply
It helps to know some Java, but it is not required. Using Scala, you will learn the necessary parts of the JVM, without having to deal with Java-the-language too much (which is kind of painful to use after Scala).

Plenty companies use Scala, including most financial institutions in London.

Given the adoption, it is unlikely that it will go away. It might not replace Java, but if you look at some metrics, Scala is the only language which is closing the gap between 2nd-tier languages and 1st-tier languages (Java, C, C++, PHP, C#, ...) and keeps moving up at a slow, but stable speed.

Scala seems to get quite some hate from both FP and OOP camps, due to unifying both paradigms fairly well: It's one of the most expressive FP languages as well as being one of the best OOP languages. It manages that without exposing a huge schism within the language.

This of course irks a lot of dogmatists on both sides.

Considering the improvement proposals: A ton of work is happening here, and I think most people agree on which parts need further improvements. But it's necessary to keep in mind that Scala stands for rock-solid releases (regressions are considered blocking bugs, any changes to binary compatibility fail the continuous integration builds, etc.).

Some changes need a lot of preparation to allow people a smooth migration while minimizing the churn; it's understandable that some people are unhappy with the speed and would like to move faster, increasing the burden on users of the language which want to upgrade.

I think the explanation why the forks are not seeing much activity is that the developers on the EPFL/Typesafe branch are just doing an awesome job. Nevertheless, they did a lot of work on the infrastructure so that forks can hook into many parts of the existing systems, making it easier for people to bootstrap their own Scala version. (Yes, they don't consider forking a bad thing, and especially the relationship between the Typelevel project and the Typesafe/EPFL developers is very good.)

TL;DR: Scala is rock-solid, has the best tooling and IDE support except maybe Java and C#, while constantly evaluating ways to further improve and simplify the language.

[+] PaulHoule|11 years ago|reply
Personally I don't care for Scala, at least from the viewpoint of a maintenance programmer.

I was working one time on a program that did what should have been trivial parallelism but there was some kind of race condition because we'd put the same answer in and get different answers.

The implementation used actors and the guys who wrote it couldn't tell me much about it (for instance, how it decides how many threads to use.) I spent a day reading docs and messing around with it and didn't get anywhere.

I woke up the next morning and rewrote it using the ExecutorService from Java in 15 min and it worked right the first time and worked ever since.

Personally my experience with Scala has improved my Java programming, but if you want a language that is "Java with fewer warts" you might be interested in C#. C# has real generic without type erasure, all kinds of support for async programming, and even had method handles long before Java did.

[+] fedesilva|11 years ago|reply
I would say that is because neither you nor the original authors had an idea of how things work (thread scheduling, etc).

Good for you if you rewrote it and it did solve your problems. Obviously it was not such a huge task, if it was, learning how to control those things would have been wiser.

In this specific case 'dispatchers' is what you were looking for (http://doc.akka.io/docs/akka/snapshot/scala/dispatchers.html) and it is quite flexible.

[+] brudgers|11 years ago|reply
Scala errors will often be described in terms of Java libraries. So I would say it's not so much a matter of knowing the language Java as accepting that you will be living in the larger Java toolchain and JVM ecosystem. The underlying layer leaks up through the abstraction.

As a point of comparison, Clojure has similar behavior, but my impression [and that is just one datapoint] is that Clojure handles the leaks a bit more thoughtfully.

The other language that lives in a space similar to that of Scala is F# with Mono/.NET offering cross platform support.

[+] Negative1|11 years ago|reply
For whatever it's worth, that scalac fork hasn't been updated in over 5 months.

From personal experience, it helps to know the Java ecosystem and the basic data structures but it won't hurt you too much if you don't. Read 'Programming in Scala' and you'll pick up on all the missing pieces pretty quickly.