Wednesday, May 9, 2012

Why Scala?

Because you write as little code as in Ruby, yet have Java-like IDE experience with compilation errors highlighting as you type, reliable refactorings, etc.

And in this case the whole is greater than the sum of the parts. Some examples:

  • You write less bugs in Ruby than in Java, because you write less code.
  • You write less bugs in Java than in Ruby, because there is a clever compiler to catch them.

In Scala you write less bugs, because you write less code.
In Scala you write less bugs, because there is even more clever compiler, that catches more bugs for you.

  • Java is faster than Erlang, because JVM is faster than Erlang VM.
  • Erlang is faster than Java, because it is easier to write scalable applications with it.

Scala is faster, because JVM is faster than Erlang VM.
Scala is faster, because it is easier to write scalable applications with it.
The compiler was written by Martin Odersky who also wrote the Java reference compiler and co-authored the generics, used by millions of Java programmers today. You can be confident his implementation of the Scala compiler produces byte code that performs every bit as good as comparable Java code.
Once compiled Scala .class files are not different from Java .class files. You can mix and match java and scala source files inside one project. It all just works, even code completion and Ctrl-click in Eclipse IDE (, etc.

Scala also supports compilation to .NET assembly (Microsoft-sponsored project) and JavaScript (by Google Web Toolkit). But the developing experience is not yet as smooth as you get on JVM.

James Gosling (the creator of Java) likes Scala.
During a meeting in the Community Corner ( booth) with James Gosling, a participant asked an interesting question: "Which Programming Language would you use *now* on top of JVM, except Java?". The answer was surprisingly fast and very clear: - Scala.

James Strachan (the creator of Groovy) likes Scala.
I'm very impressed with it! I can honestly say if someone had shown me the Programming in Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy.

Alex Payne (Twitter API Lead) likes Scala.
Alex Payne spent over a year researching the best language with which to approach the architectural challenges at Twitter, the popular social messaging platform on which he works. In this talk, he’ll share for the first time in public why he settled on Scala.
Scala is trying to avoid becoming a "kitchen-sink language". Scala is comparable in feature count to Java, but has far fewer features than C++ or C#. Scala removes from the Java feature set: static members, primitive types, break, continue, special treatment of interfaces, wildcards, raw types, and enums. Scala "concentrates on the glue", not on features. Leveraging abstraction, users can implement the features they need in the language, rather than the language itself supporting every possible use case. The same set of constructs are intended to support both small and large programs.

I myself first discovered Scala in 2006 in the list of more than 100 experimental JVM languages and wondered why it is not popular. There were no books on Scala, and almost no blog posts. Now in 2012 you can buy one of the 27 books written on Scala.

Scala in the Enterprise
Your company can also benefit from using Scala, just like LinkedIn, EDFT, Twitter, Novell, the Guardian, Xebia, Xerox, FourSquare, Sony, Siemens, Thatcham, OPower, GridGain, AppJet, Reaktor and many others.

Scala is being used by many more organisations and steadily moving into mainstream business critical applications. Scala's use has grown by a factor of 10 over the last year and it has matured into a solid production language.

David Pollak and Dick Wall Discuss Barriers to Scala Adoption
InfoQ: Is it hard to find developers to program in Scala? Why?

David Pollak
No. It's easy to find good Scala developers. It is hard, however, to find large swaths of Scala developers. I can put together a great team of 10 Scala and/or Lift developers next week to drop on a project. They won't be cheap (average cost $250/hr plus whatever markup I add.) They won't be local. But they will be excellent.
Foursquare and Twitter and others are hiring excellent developers of all stripes and generally making them excellent Scala developers. 
What is difficult is to find an outsourcing team of 25 Scala developers at $40/hr fully loaded. You can find plenty of PHP and Ruby and Java developers at that price, but few Scala developers at that price.

You can take a look at the Scala code example in the next article.

No comments:

Post a Comment