Hacker News new | ask | show | jobs
by bad_user 4481 days ago
Before Scala, I have "mastered" until now Ruby, Python, Perl, PHP, Java, C# and Javascript as in I used them for real projects in production for at least 1.5 years each and whenever I learn a new language, I always go in depth. And I also played with half a dozen others.

Scala is the language that helps you write better code. In the kinds of projects that I've been working for the last 3 years, requiring parallelism, efficient usage of resources, asynchronicity, redundancy, scalability, throughput, reliability on the whole, I can honestly say that none of the other languages could do a better job.

On features, it actually doesn't have many, but the features that it does have are powerful enough that you can have bigger abstractions. For example, "async" is not a language feature such as in C#, but a library. Of course, there's much to learn, especially concepts that have been borrowed from Haskell or other FP languages with a Scala-ish twist, like persistent data-structures, type-classes, futures/promises, iteratees and in general, what's the deal with monads, monoids and applicative functors. In training beginners explaining these concepts was the most difficult part of the training, trumping all others considerations, starting from the basics like "don't use vars".

Scala is difficult because it's a functional programming language, beautifully blended with OOP, being in fact a better OOP language than most mainstream OOP languages. Learning FP and then learning OOP in a way not exposed by languages like Java and then learning what good design looks like, grokking a lot of FP design patterns in the process, that can be very overwhelming. For any developer that is not familiar with a good FP language already, or that thinks OOP is what Java gives you, the transition can be pretty painful. On the other hand - I'm of the opinion that if learning a new language is not painful, then it doesn't give you anything of value, so learning it is pretty useless.

1 comments

What would you say was the best resource to learn it? I've been curious about Scala for a while, but never really taken the plunge.
I happened to have written a blog post a year ago, that's still valid I think: https://www.bionicspirit.com/blog/2013/05/13/getting-started...

Two takeaways from my article:

1. start reading a book on it

2. subscribe to the scala-user mailing list and ask any questions you may have - some developers there are very advanced, so don't get intimidated by the topics, as beginners' questions are very welcome

I got started with "Scala for the Impatient" and I like its style. You can still get about one third of the book from TypeSafe's website, which is enough to get the ball rolling. It's written for Scala 2.9 so it doesn't have Futures in it, plus you should ignore the stuff about actors in later chapters (actors from the standard library are deprecated, Akka actors have been the norm for some time - and at first you should ignore actors completely, since that's a big topic). But that's OK. In case you'd prefer another book, make sure to not read anything published before 2010 as (IMHO) everything published before 2010 is awful.

Since I wrote that article a couple of newer books happened, that I haven't read, like "Scala in Action" or "Atomic Scala" and thus cannot recommend, but I've heard good things about, so ask others or read reviews, etc...

There's also an advanced book called "Functional Programming in Scala", by Paul Chiusano and RĂșnar Bjarnason, I've read about 8 chapters from it and it's a really, really good book on FP design & concepts. However it's a hard read, because while the language is approachable and doesn't assume much Scala knowledge, it's the kind of book that's designed around mind-bending (SICP-style) exercises - it takes me about 1 week to get through a chapter and right now I don't have time for the rest, but with each chapter my knowledge expands :-)

If you like an IDE, IntelliJ IDEA 13 for Scala is everything you'd expect out of an IDE, but as I've said in my blog post, when I'm learning a new language I don't want to bother with learning a new toolset too, so I start with a comfortable plain-text editor and work from there.

When you get stuck, I must emphasize on nr.2 - ask questions on scala-user - beginners are always welcome.

Scala School is probably a good starting point: http://twitter.github.io/scala_school/

As for books you may want to check out Scala for the Impatient and Programming in Scala.

Scala for the Impatient (you can get part of the book as a free pdf from Typesafe). Although not designed for learning the language the O'Reilly Scala Cookbook is also very good.