tags:

views:

351

answers:

5

I'm a Java dev thinking about investing time in learning Scala to develop future apps. I've read quite a bit about the advantages of Scala over Java, but they're a bit abstract to really sell it to me emotionally.

Can someone suggest an example of an application that would really suit being developed with Scala, as opposed to Java?

+1  A: 

This is such a daft question. Scala is a turing complete language: ergo it is equivalent in what can be developed to any other TC language.

It has access to all JVM libraries (including those written in Java) and hence has a leg up in terms of access to databases, media APIs, networking et cetera et cetera et cetera. Being a JVM language, it has the advantage of write-once-run-anywhere (WORA).

But of course Java has these as well! So what is Scala's strength? Well, clarity, expressivity, maintainability, extensibility et cetera et cetera et cetera.

And what app does this point you to as being a killer? Well, all of them of course! Have some fibs!

def fibs = (0, 1).repeat[Stream].map { case (a, b) => b -> (a+b) } map(_._1)

or:

lazy val fibs: Stream[Int] = 0 ::# 
  ( 1 ::# 
    fib.zip(fibs.tail).map { case (a,b) => a + b)))

PS. The only thing it is not very good for, is extremely close-to-the-metal, low-latency programming. And it's making inroads into this area too!

oxbow_lakes
I'm not the downvoter but I don't like the idea that *if it's turing complete it can be used for everything*. It's like saying you can write interrupt handlers in Javascript.
Alexandre Jasmin
Yes, but then I went on to point out that it also had the same set of libraries written for it as Java. Scala can have a killer feature, for sure - but the question, as currently posed, just *makes no sense*
oxbow_lakes
"it's making inroads into this area too!" << How so?
missingfaktor
Well, i was referring to what Kunle Olukotun talked about at ScalaDays2010 - http://days2010.scala-lang.org/node/136. It was the keynote speech on the second day and I expect we'll start seeing the "fruits" of this work over the next 6-12 months. It was about using Scala to create a DSL which compiles down to a parallel execution platform. At least, that's what I think he was saying!
oxbow_lakes
+3  A: 

Anything that's massively parallelized that uses the Actors idiom from Erlang would be a 'killer' in my view.

duffymo
But the actors library "Akka" has bindings for Java actors too. And, implicit in your answer, it doesn't differentiate scala from Erlang!
oxbow_lakes
True - it'd be equally killer in Erlang.
duffymo
+4  A: 

many...

Vijay Mathew
+9  A: 

I think, the companies listed at Scala in the Enterprise on scala-lang.org are the examples that the community can be proud of. They use Scala for building high-concurrency (and heavy-load) distributed scalabale applications with expressive type-safe lightweight APIs, great abilities for code-reuse and creating internal DSLs, development productivity and for many more reasons.

Just to give some names:

Vasil Remeniuk