views:

577

answers:

6

I've been programming in Java for the last few years, but due to disappointment with the current state of the language I'd like to switch to another JVM language with all the goodies of dynamic languages and features like closures, etc. I've looked around and Scala and Groovy seem the most popular choices. Am I missing other good languages? I'm favoring statically typed languages so currently I'm leaning towards Scala. I'd like to have other people's opinions on the matter and know if the community is large enough to ensure the future of the language.

+13  A: 

Scala should be good.

With Scala you can have:

  • Advantages of running on a JVM and using all of JVM tools.
  • You can use all your Java libraries.

Scala has :

  • closures and functions are part of lang.
  • operator overloading support.

  • supports interfaces which can contain implementation known as mixins

  • concise and clear than java

Hope you have read this Daniel Spiewak blog :

http://www.codecommit.com/blog/scala/roundup-scala-for-java-refugees

Some more useful links:

http://www.scala-lang.org/

http://creativekarma.com/ee.php/weblog/comments/why_scala_instead_of_java/

http://jim-mcbeath.blogspot.com/2008/07/mixing-java-and-scala.html

YoK
Reasons?.......
Robert Harvey
Blanket statements like that tend to be really, really unproductive in (mostly subjective!) conversations about programming languages.
Gian
@Robert Harvey and @Gian I was writing my answer and submitted it without realizing. Sorry about that. I have completed my answer.
YoK
I really didn't mean to post just single line.. I never do that :(
YoK
+1 to balance unjustified downvotes
seanizer
Interesting that you picked Operator Overloading as an essential feature. I wouldn't consider a language complete without it; that said, I have never needed it.
Robert Harvey
@YoK: Upvoted now that you have added all of that useful information :)
Gian
Scala is a great language.
Artur Gajowy
@Robert Harvey: Actually, the great thing about Scala is that it *does not* have operator overloading. It doesn't even have operators. It's just that `+`, `-`, `λ`, `×`, `★` or `::===!!===::` just happen to be valid identifiers in Scala and that you can call methods that take only a single argument without a dot and without parentheses. (Well, actually, that's not *quite* true. There is *some* built-in precedence support in the parser for operator-style method calls with methods whose names begin with certain characters, in order to make stuff like `3 + 4 * 5` work as expected, but that's it)
Jörg W Mittag
Huh? The website scala.com does not have anything to do with Scala the programming language?
Jesper
oh ya its scala-lang.org
YoK
+10  A: 

This question may help

http://stackoverflow.com/questions/2571267/modern-alternatives-to-java

irishbuzz
+1  A: 

Do you know that Groovy is in fact typed ? Its only downside, for that matter, is that it is weak-typed..

However, for a more complete reply, authors of Groovy frequently argue that Groovy is how Java should have looked, were it designed correctly (and 15 years later).

And Scala users often quote Groovy initial developer saying that Scala is Groovy as it should have been.

However, I tend to consider Scala to be far more (maybe too) functionnal than Groovy.

But I think the decision is only yours.

Riduidel
+1  A: 

I think Scala has the tractions to be a viable alternative for the future. There is such a buzz and ecosystem springing up around it now so I do not see it going away in the near term.

Personally I am leaning to clojure right now, but I am afraid this might not suit your taste.

In any case I see a future with many more languages being used on specific projects and leverage their respective strengths. This is already the case with HTML, CSS, Javascript, XML, BPM, .... It is a matter of time before everyone realizes that 'coding' logic can be done in different languages too, each in their area of suitability.

Peter Tillemans
+16  A: 

Scala and Groovy are both great.

You should also add Clojure to your list to consider/research. It's newer than Groovy and Scala (and therefore probably has less visbility / following on the web so far) but has some very compelling features, particularly if you are interested in functional programming and concurrency.

My favourite features:

  • Emphasis on high performance, immutable data structures
  • "Code is data" philosophy with very powerful macro capabilities (as with most LISPs)
  • Lazy evaluation and functional programming (somewhat Haskell-inspired perhaps?)
  • It's a dynamic language, but is fully compiled and gets pretty good performance
  • Very good interoperability with Java code

If you haven't seen it, I'd strongly recommend watching this video by Clojure creator Rich Hickey:

http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey

mikera
Clojure is a great language.
justkt
+3  A: 

You may also consider Groovy++ or Mirah. My personal favorite is Scala, however.

Alexey Romanov