Like many developers who make the journey from Java to Scala, I often find myself amazed at how much easier it is to do some things, or how much easier it is to express myself in Scala.
“ScaLearning” will be a series of short blog-posts just documenting little tidbits I find interesting, confusing, amusing, or otherwise worthy of talking about.
Is Scala Hard to Learn?
If you want to skip the explanation, my answer is no.
To elaborate, I’ve heard a great deal of “buzz” about how complicated Scala is. I’ve heard it said that it will become an academic language, and that average programmers won’t be able to pick it up. Unfortunately, the blogosphere is so cluttered with rebuttals to the idea that it’s hard to find anyone actually critiquing Scala.
Some examples of pro-scala posts:
Some examples critiquing the complexity:
My Verdict on the Scala Language (Doug Pardee)
Is the Scala 2.8 Collections Library a Case of the Longest Suicide Note in History? (oxbow_lakes)
Since a lot has been said already, I won’t go into any in-depth tirade about software complexity. I will, however, draw on my experience:
For me, Scala has been easy to learn after a few years of Java because:
- Type system that’s similar to Java
- Java interoperability allows me to ease myself in
- It’s possible to write near-Java syntax, and have it be valid Scala
- Many Scala keywords have direct analogs in Java (ie: public final String s vs val s : String
So far I’ve done two “projects” in Scala.
One was a Lift (version 1.x) application that talked to a back-end set of Jersey services. The native XML handling was a dream-come-true, but the mapping of Lift 1.0 made me think Scala was much harder than it is.
The second project was an experimental conversion of a Spring MVC application using JSP views into a Lift 2.x website. I left the backing services in Java, used Spring to get the dependencies, but rewrote the front-end to be Lift. The mapping I hated in 1.x had been completely overhauled, and was actually very pleasant to work with.
That brings me to the take-away of this post.
A large part of the “complexity” people see in Scala isn’t the language. It’s the libraries and frameworks.
Scala, as a language, is very simple and very powerful. Overall, while I don’t know every feature, I feel as if I know enough to be able to understand most of the code I read, and colleagues familiar with Scala seem to be able to read the code I’m writing.
I find Scala very easy to learn. Some libraries have been a challenge… but then, so is learning the exact magic incantation for Java’s file IO.