I would disagree that Scala is controversial. It's less controversial than
Java was when it came out in 1995. Scala's been around since 2004, and over
the past couple of years, it saw major adoption at LinkedIn, Twitter,
FourSquare, Netflix, Tumblr, The Guardian, Airbnb, Meetup.com, Coursera,
UBS, Ask.com, AT&T, Bloomberg, eBay, The Weather Channel, etc. It's not
merely academic.

It's pretty obvious that Java has many major shortcomings, especially in
the functional programming realm. Java 8 added lambdas, but it didn't add
currying, partial application, tail call optimization, and so on. Java's
"BoilerPlate boilerPlate = new BoilerPlateImpl()" is poorly suited for data
science and other cases that require expressivity. Scala's type system is
both stronger than Java's (e.g. Scala's arrays are invariant while Java's
are covariant, which was an error in language design) and more flexible
(covariance and bounds, not just bounds like in Java). Scala's type
inference cuts out the boilerplate. Implicit conversions make
domain-specific languages possible. Pattern matching allows decomposition
that's much more expressive than Java's "instanceof," switch/case and
if/else. ClassTags also allow you to combat type erasure - how can you
check if something is List<Integer> vs. List<String> at runtime if the
types are erased (a major sin that Java committed yet C# didn't). The list
goes on and on.

Since Scala compiles to Java bytecode, you have all the Java libraries
available at your disposal, but there's no question that the language is
better, more type safe, more expressive, more concise, etc. The functional
programming features are so much better than what Java 8 *stole* from Scala
(look how they even copied the method names such as compose/andThen from
Scala) that it's hard to even begin to compare. You can still use your old
Java tools like Maven and JUnit/TestNG, though Java tools such as SBT and
ScalaTest are much more feature rich.

I'm not saying that Scala is perfect, but it's very good, and I would
advise others to form their opinions based on experiencing it for
themselves, rather than reading what random people say on Hacker News. :)

Marek




On Thu, May 29, 2014 at 1:55 PM, Nick Chammas <nicholas.cham...@gmail.com>
wrote:

> I recently discovered Hacker News and started reading through older posts
> about Scala <https://hn.algolia.com/?q=scala#!/story/forever/0/scala>. It
> looks like the language is fairly controversial on there, and it got me
> thinking.
>
> Scala appears to be the preferred language to work with in Spark, and
> Spark itself is written in Scala, right?
>
> I know that often times a successful project evolves gradually out of
> something small, and that the choice of programming language may not always
> have been made consciously at the outset.
>
> But pretending that it was, why is Scala the preferred language of Spark?
>
> Nick
>
>
> ------------------------------
> View this message in context: Why Scala?
> <http://apache-spark-user-list.1001560.n3.nabble.com/Why-Scala-tp6536.html>
> Sent from the Apache Spark User List mailing list archive
> <http://apache-spark-user-list.1001560.n3.nabble.com/> at Nabble.com.
>

Reply via email to