Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've noted that IDE support is nowhere near as good, but the language itself supports functional programming idioms much more cleanly.

share|improve this question

closed as not constructive by MichaelT, gnat, thorsten müller, Bart van Ingen Schenau, Jalayn Apr 17 '13 at 12:38

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Python is my religion, so I only care about what Guido thinks of Scala. neopythonic.blogspot.com/2008/11/scala.html –  Job Dec 11 '10 at 14:40
6  
Scala is such a great language that it not only attracts all these great minds the Scala community has, but sadly also a lot of envious haters which try to find basically anything to attack the language and the people using it. –  soc Dec 11 '10 at 14:53
    
@soc: Just to be clear: I do not hate Scala, and the people who use it probably couldn't (shouldn't!) care less about what I think about it. I think it's too complex. That's all. Complexity may be all right for those who have a big brain. I don't :-) –  Joonas Pulakka Dec 11 '10 at 21:22
3  
Sorry, I just get annoyed when people keep repeating myths without backing up their claims. –  soc Dec 11 '10 at 23:21
2  
@soc: Well, this whole question is entirely subjective, so any answer is right, be it myth or not. –  Joonas Pulakka Dec 12 '10 at 6:47
show 2 more comments

10 Answers

up vote 16 down vote accepted

I've been programming Scala for more than one year now, so I'll try to set myself back a year to answer this question.

  • Scala code is more concise than Java code (no setter or getter, a lot of the type information can be inferred)
  • The built-in support for XML literal is very appealing.
  • Java library compatibility and interoperability is great
  • The support for certain functional idioms is refreshing (for comprehension, closure, lambda functions, map, fold, reduce)
  • There does not seem to be a cool feature that the language creator did not want to include

The points above were more or less what I thought of Scala before I started to learn it.

In the course of a year, here is what I found out:

  • Buying the staircase book was a great investment and has saved me hours of learning things on my own
  • The syntax has some quirks and there was sometimes where I was really puzzled why something was not valid. The trade off is once you're familiar, the code has less clutter and is easier to read. Note that this isn't really an issue if you read rather than write code.
  • The collection library in 2.8 is a pleasure to use. It's hard to come back to the Java one.
  • XML literal is nice, but beyond some basic things, I had to reach out to the Java library ecosystem. It's convenient though.
  • Using Java libraries from Scala is super easy and convenient. Using Scala classes from Java is a bit more tricky, but it works.
  • I've switched to IntelliJ IDEA community edition and although it's not perfect it's more than good enough.
  • The language creator really thought about the set of feature and all works really nicely together. The object oriented support is better than in Java (with the traits) and you can do functional programming.
  • It's a language that apparently some Java developers hate with a passion. For me, it has brought back the joy of programming.
share|improve this answer
add comment

Well, I think Scala is too complex. It feels like C++ in that it has a myriad of different ways of doing things. Some would call this "richness", "expressiveness" or "power", but your mileage may vary. In many real world projects you would have to artificially limit what language features you're going to use and what not, so that all developers involved could speak the same subset of the language.

For functional programming I prefer Clojure, which is way simpler than Scala.

Let the holy war begin ;-)

share|improve this answer
1  
If only Rich Hickey cared as much about .Net as he does about JVM ... –  Job Dec 11 '10 at 14:43
    
It would be helpful if you explained a little bit more about what things you feel are too complex. –  Richard Warburton Dec 21 '10 at 19:21
4  
@Richard Warburton: The issues of Scala's complexity (or, as Martin Odersky puts it, "strength and a problem of Scala: its extensibility") have been widely discussed in lots of forums. One such discussion is here. I'm not saying that complex == bad per se. The problem is that while the brightest 1 % of programmers may be able to do miracles with Scala, the vast majority simply isn't going to "get it", and that is a problem for real world usage. It's like a Formula 1 car: the vast majority of people simply won't be able to drive such a beast. –  Joonas Pulakka Dec 22 '10 at 7:33
2  
+1 For mentioning Clojure as valid alternative (when it comes to functional programming). –  Oliver Weiler Dec 27 '10 at 17:46
    
Clojure is great, but is it as performant as Scala? Is it as easy to refactor, without all this static typing? (Refactoring Python is pretty hard, for instance — I did write refactorings for it.) –  9000 Dec 27 '10 at 19:03
show 3 more comments

It's an excellent language that is simpler than Java in many ways.

Most people won't like it, Java programmer or not, for the same reasons that most people, programmers or not, don't like learning new programming languages. I suspect that most people who learned a programming language did not even like learning that.

If you're worried about a language being as complicated as C++, I would avoid Clojure like the plague. Whining that Scala is more complicated than Clojure has become the fallback argument for people who are completely ignorant regarding one or both languages.

Clojure has macros, which means you can alter the language's syntax as much as you want, giving you not just "a myriad of different ways of doing things" but an almost infinite number of ways of doing things. And none of this new syntax the programmers are creating with the macros will be documented anywhere in the language specification.

"But we can avoid using macros or regulate which ones are allowed in our code", you say. Congratulations, you're now having "to artificially limit what language features you're going to use and what not", which is exactly what the babbling idiots who are using Clojure of Scala used as their reason for avoiding Scala to begin with.

share|improve this answer
6  
Thanks for your Scala vs Clojure input, but is that what the OP i asking about really? –  Martin Wickman Dec 11 '10 at 15:07
    
Interesting point re: macros. Slightly worrying, also. Are macros or similar available in Scala, or is the whole "artificially limit" thing a distraction? –  Alison Dec 11 '10 at 17:56
1  
This seems to be a comment to my answer rather than an answer to the original question. I agree, macros give you infinite power, so when used wrong, they suck. So, you ought to use them right (only when needed). This doesn't change the fact that Clojure the language is one of the simplest ones there is. Scala definitely isn't. –  Joonas Pulakka Dec 11 '10 at 21:12
    
> This doesn't change the fact that Clojure the language is one of the simplest ones there is.< This is also completely false, unless you're using some metric like "number of language constructs". If you're using something useful, like how easy is it to read and write programs in the language, then Clojure is not one of the simplest. –  Josh Dec 15 '10 at 14:17
    
So please go on and give a us a good metric of language complexity. "How easy is it to read and write programs in the language" is totally subjective, so it doesn't really help here. Granted, coming up with an useful and objective metric may be virtually impossible. (For example Jörg W Mittag below is using number of pages in language specification as a complexity measure. While objective, I'm not sure it's very useful.) –  Joonas Pulakka Dec 22 '10 at 7:39
show 2 more comments

About one year ago, as I became more and more frustrated about the future of my startup's products if I continued to use Java, I decided to give Scala a try. I was already programming in JavaScript and Python at the time, Ruby was also a good alternative, but I was looking for a statically typed language, preferably one that could run on the JVM.

I really tried to like Scala, I really did, but I found it's code utterly ugly and hard to understand. I dramatically wondered that if Scala was our best answer to Java, then I was surely screwed and sentenced to continue working with a language I didn't liked after all...

Fortunately, not too long afterwards, I found out about Fantom. Oh man, did I loved it! To me, it was like american's splendor answer to german bureaucracy! It matched the requirements I was looking for in Scala, but much more elegantly. It had Vim, Eclipse and Netbeans integration, a nice web framework, mature products running with it, a small but incredibly helpful community... Dynamic and Static typing! I rejoiced!

(I could continue but this post is meant to be about Scala, not Fantom, so I stop here. My preference is clear, nevertheless there's this post comparing the two. I never could understand why Fantom gets so little attention when compared to Scala. But apparently I'm not the only one, if you listen to this podcast [mp3] until the end.)

share|improve this answer
add comment

When I initially dabbled with Scala 2 years ago, it looked alien and intimidating to me. At some point I discovered that the core language is actually much simpler than Java, but its syntax and semantics are so flexible that you can create new language constructs like it, even without a macro feature. I have since completely switched to Scala for all my Java projects, because it lets me write without too much boilerplate code.

I like Clojure, but there are situations, where the platform needs you to compile to static bytecode (Android, applets, ...) and while you can do that, in Scala, it's just there.

While Scala lets you solve many problems in a functional way, I often find problems where using classes feels more natural. That makes things a bit more complex, but nowhere near the complexities and pains of C++.

The biggest takeaway for me when I really started learning the language was that I could program just I did in Java, just without the noise (a little bit like when you start Groovy), but eventually you want to try to dive deeper into the power of the language - it grows with you.

About the IDE question: After using Emacs for everything, all my IDE issues went away :-)

share|improve this answer
add comment

I really like the Scala library's more granular types. It seems like the new collections library was well thought-out. I also like how it reduces the amount of code required for simple classes, and the functional concepts it adds. Its type inference is also very helpful. It feels like Java without the training wheels. After using C# for a while, Scala actually feels like a competitor, with Java still useful but being left behind.

share|improve this answer
add comment

I like Scala for many reasons, but there is one that is often overlooked: its simplicity.

Scala might not be as simple as, say, Oberon, but it is quite a lot simpler than some other languages. The Scala Language Specification is ~160 pages, the Java Language Specification is ~600 (just the language, not the JVM or the libraries!), the ECMA-334 C# Language Specification (which AFAIK corresponds to a subset of Visual C# 2.0) is ~440 pages (this is without stuff like LINQ query comprehensions, lambda expressions, extension methods, generic co- and contravariance, dynamic, optional arguments with default values, keyword arguments, var). Even the current draft for ECMAScript 5.1 is bigger at ~210 pages. And of course my own "default" language, Ruby, whose current ISO Draft weighs in at ~310 pages, which only specify an almost unusably tiny subset of the intersection of Ruby 1.8.6, 1.9.1 and 1.9.2.

share|improve this answer
6  
Number of pages in language specification is an interesting measure of its complexity. It's amazing how Scala divides opinions about this. Nobody would say Python is complex, or C++ is simple, but Scala seems to be both :-) e.g. scala-lang.org/node/7431 –  Joonas Pulakka Dec 13 '10 at 7:04
    
You can build complex things with the language, and some will look as if they were the language - methods with non alnum names, which look like operator overloading, which it isn't, for example. –  user unknown Feb 13 '11 at 1:52
2  
Number of pages in the language spec is a TERRIBLE way to compare complexity of two languages. Just to give two examples: the Java spec is written in a nearly tutorial fashion while the Scala spec is written in a very terse fashion. Or another example, C# 2.0 was actually roughly as complex as Java today, or perhaps a bit more complex given the "unsafe" machinery, delegates, and prpoerties. But as you note the C#2.0 spec is smaller than the JLS. –  James Iry Mar 4 '11 at 0:52
1  
Now, Martin Odersky has compared the size of the formal grammars of the languages. That's a reasonable measure of one aspect of complexity. But it's only reasonable because grammars aren't as flexible as English. Even then, you have to be careful. Just as with ordinary programs, you can easily stretch or shrink grammars with different choices about how to lay them out, how many distinct productions to include, what base character classes to assume, etc. –  James Iry Mar 4 '11 at 1:09
3  
wait .. what ? Why would you try to measure complexity with size of the spec ? Its a terrible idea. –  smartnut007 May 17 '12 at 0:29
add comment

Here is what sucks about Scala:

  • The null pointer was a pretty bad idea to begin with. Hoare called it his "billion dollar mistake", but Scala is even worse. It has objects named null, Null, None, and Nil. null is for interoperability with Java. Null is the null pointer form W3C DOM specification, None is what null should have been replaced with, and Nil is an empty something.

  • When language constructs turn out to be hacky it is usually the programmer who is to blame and not the language. In Scala, however, the core language already contains library classes whose only documented behavior is "This is a hack". Don't believe it? Search the scaladoc for scala.xml.Group.

  • Last not least, Scala is badly documented. Hardly any of the scala classes in the official documentation comes with example code. Scala is significantly harder to learn than Java and requires profound knowledge in computer science.

To avoid being mistaken for a Scala-hater, here is what I love about it:

  • I have fewer exceptions. I never had a ClassCastException and very few NullPointerExceptions when interacting with Java.
  • Code is much shorter and more concise than Java
  • It is intellectually challenging. Java feels like baby language when compared.
share|improve this answer
8  
null is Java's null pointer, Null is the "type" of it. None is one possible "state" of Option[T], a collection with either one or zero elements. Nil is an empty list. While you want to make it sound frightening, it isn't. Those types are not replaceable or interchangeable with each other and behave exactly as they should do. –  soc Jan 2 '11 at 14:40
add comment

Scala is complex. No way around it! Its syntax is extremely flexible and can be customized in numerous ways (above all operators / infix notation) - and the type system has more different features than any other language I know.

So things aren't that straight as e.g. in Haskell: Typeclasses to cover them all.

As Scala tries to put together functional programming, OO, procedural programming and java libraries as well as own ideas, we finally end up with lots of concepts that somehow seem to go "in the same direction":

  • Implicit values
  • Implicit functions
  • Existentials
  • Wildcards
  • Traits
  • Interfaces
  • Abstract classes
  • Case classes
  • Structural types
  • Generic constraints
  • View bounds
  • Anonymous types

Choosing among them seems difficult at first and one might easily wonder if one has found the correct solution to some problem. It's even easily possible to produce hacky stuff by abusing implicits.

But the interesting thing is: Scala works. It's sometimes hard to understand why (especially figuring out through what implicit conversions + inheritance + ... some object has got functionality X), but you don't have to bother about that most of the times.

Write Scala as straightforward as possible and it will work. Don't get confused by everything that is possible and just use what you need. And if you need something, you can be sure that somehow Scala has it ;)

And the better you get, the more you'll be able to customize Scala with operators, implicits, monads, funky syntax ... and finally get something close to a DSL that will perfectly address your problem.

After all, you have always the possibility to just use Scala as a much much better Java with cleaner, easier syntax, type inference and some functional features.

share|improve this answer
    
"above all operators / infix notation" - just that scala lacks operators. :) It's just methods. –  user unknown Feb 13 '11 at 1:55
add comment

As a Java programmer, I initially found Scala interesting. However, after dabbling with it for awhile (and running into nearly all the positives/negatives already listed by others), I was left feeling very "meh" towards it. The language improvements are offset by the lower availability of toolsets. I just couldn't come up with any defining reason to switch over. It's good, but it's not "better enough" to make a case for switching. Doesn't have that subjective excitement factor either (like Clojure seems to).

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.