I've noted that IDE support is nowhere near as good, but the language itself supports functional programming idioms much more cleanly.
closed as not constructive by user40980, 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.
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.
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 ;-)
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.)
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 :-)
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.
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.
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
- 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
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.
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.
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.
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).