
Ask HN: What are the best resources to properly learn Scala? - godmodus
Hello, I&#x27;ve started to work with scala and I think it&#x27;s a beautiful language. that said, I&#x27;d like to be better at it. What are some good books to get thst teach about the nitty gritty details of the language and it&#x27;s use in production?
======
noelwelsh
I'm the author of a couple of books on Scala: Essential Scala and Advanced
Scala. You can find them here:
[http://underscore.io/books/](http://underscore.io/books/)

Depending on what your background and what you want to learn, different books
will be appropriate:

\- Our books are focused on what we consider the most important concepts for
functional programming and how they are implemented in Scala. If you want to
know about algebraic data types, type classes, and so on, and how to implement
them in Scala or use the implementations in the Cats library our books are a
good choice. We emphatically do not teach all the language. If you want to
know about OO features like self types and trait mixins don't turn to our
books.

\- Odersky's book has a lot of detail. It does a good job of presenting all of
the language but doesn't IMO do a good job of showing you how to use the
language.

\- FPiS is a very good book that does what the title suggests. My main
criticism is it can take a bit long to get to the point and it doesn't talk
about libraries you might use in practice like Cats or Scalaz.

\- The Coursera courses I have taken are fairly good, but don't do a great job
of talking about the higher-level design concepts.

I haven't read other books, so can't comment on them.

Finally, if you don't have a background in formal CS our free book Creative
Scala might be useful. The current draft is at
[https://dl.dropboxusercontent.com/u/8669329/creative-
scala.p...](https://dl.dropboxusercontent.com/u/8669329/creative-scala.pdf)
and the source is at [https://github.com/underscoreio/creative-
scala/](https://github.com/underscoreio/creative-scala/)

~~~
pc86
I'm interested in hearing about your team and diversity discounts, it doesn't
look like there is any information on them on the site (unless I missed it!)

~~~
noelwelsh
Team discount is 20% off for purchases of ten or more copies.

Diversity discount ... I don't think we have a policy for books, but for
training we offer 50% off to people who are under-represented in tech and I'm
happy to offer the same for books.

Email me (noel at underscore.io) to arrange either.

------
vasshu
There is a course on Coursera thaught by the Scala creator:
[https://www.coursera.org/learn/progfun1](https://www.coursera.org/learn/progfun1)

~~~
gingerbread-man
It's actually a series of 4 courses, 5 if you include the "capstone project."
I've watched a few of the videos-- it's pretty decent, but intended for those
who don't have much experience with functional programming. The first course I
believe is modeled off the Structure and Interpretation of Computer Programs.

I think the answer to this question really depends on where you're coming
from. An experienced Java developer will need to focus on different things
than someone who has spent the last decade hacking Common Lisp or OCaml.

~~~
joncrocks
I would agree and disagree.

The first course is the one that's dedicated to Scala the language, whereas
the rest are more focused on reactive/parallel programming that happens to be
in Scala.

The first course is good, and acts as a good introduction if you've
encountered functional programming before.

------
SatvikBeri
I found _Functional Programming in Scala_ to be the best source:
[https://www.amazon.com/Functional-Programming-Scala-Paul-
Chi...](https://www.amazon.com/Functional-Programming-Scala-Paul-
Chiusano/dp/1617290653/)

~~~
nrinaudo
I would say that rather depends on what OP means by "properly".

If OP already knows Scala and would like to get better at it _and_ one assumes
that "Scala as Haskell in the JVM" is more desirable than "Scala as a better
Java", then yes, that's a great suggestion.

If OP wants to learn Scala from the ground up, I disagree pretty strongly with
starting there. It's a great book, well written, with a wealth of challenging
and mind-opening exercises, but I wouldn't recommend that as anyone's first
exposure to the language. The second or third, sure, but it purposefully
restricts itself to what its authors consider a sane subset of the language.

I happen to agree with their definition, but, in my experience, knowing a
programming language is about reading it as well as writing it, and by
restricting your learning to a subset of the language, you'll find yourself
unable to understand perfectly valid, normal code - code that is part of the
standard library, for instance.

I would rather suggest reading Odersky's book while allowing oneself to skip
large chunks that go rather in too much details about fairly useless things
like the XML API. Or going through scala-exercises ([https://www.scala-
exercises.org](https://www.scala-exercises.org)). Or the coursera class - its
first incarnation was pretty good, I assume the new one is at least of the
same caliber. They might not make you an expert overnight, but they'll get you
to know most of the Scala features you're likely to encounter in the wild, and
to be able to read and learn from most Scala OSS projects.

~~~
SatvikBeri
I actually learned Scala from this book, and the only languages I had used in
production before were Python and Fortran. I don't think learning the
functional subset first made it harder for me to learn the object-oriented and
imperative parts later on. Plus, understanding the functional subset gives you
a better understanding of many of the internals, such as what `for`
comprehensions are actually doing.

Of course, if you _just_ read one book and stop there, I'd agree. But most
people will continue learning from tutorials, videos, stackoverflow, etc.

I've also seen several other people learn Scala this way, usually without
knowing any functional programming before, and really haven't seen any signs
of issues wrt not understanding code written in other styles.

------
scalatohaskell
Depends on your level. Scala is extremely powerful, and so can be you. Just
pick progressively more and more advanced books, and you'll be there in no
time. Compiler's always got your back. Seriosly, I've been on search for good
language for last 8-10years, always been unhappy. 2 years ago I started
working with scala, and never looked back. I am happy with it and I can see
myself doing it for as long as it's around and there is competetive market.

~~~
edem
Until you try clojure or even kotlin

~~~
scalatohaskell
I mastered kotlin to dev some mobile apps. Having years of C# behind me, it
does not impress me much.

Clojure only for fun, I need types. But lisps sounds fun. Can't comment more.
Prehaps you're right ;)

~~~
edem
There is `clojure/core.typed` if you want types or `clojure.spec` if you want
specs. What I love in Clojure (and in any lisp for that matter) is that you
can imlement language features if you need them and the language itself
provides you with many but only if you need it (optional dependencies). This
gives you flexibility which you can only dream of if you use scala.

~~~
scalatohaskell
I know of clojure typed. But im worried it needs to be first class. I.e i need
all my dependencies to be typed, as that is my api and it usually covers large
surface.

Id also be careful with your 2nd statement. Scala has macros.

Im happy clojure is on the block, dont get me wrong :) each to their own. Type
system is incredibly important to me and my productivity.

~~~
edem
Scala macros are not like clojure macros. Clojure is homoiconic while scala is
not so you really can't compare the two.

------
sreque
I would recommend the stairway book and the coursera course. I would also
steer away from the some of the other recommendations posted here, including
"Functional Programming in Scala", which are basically teaching you how to
write Haskell in Scala. I don't think this is a good way to learn Scala
because I don't think Haskell-style code makes for effective Scala.

~~~
dominotw
>I don't think this is a good way to learn Scala because I don't think
Haskell-style code makes for effective Scala.

Why is writing functional code in scala not effective? How would one go about
understanding 'for comprehensions' in scala without understanding what
flatMap/map is used for in lieu if exception. Or why pattern matching is used.

~~~
sreque
In my opinion, functional programming, like most programming terms, including
object-oriented programming, means very different things to different people.
For example:

1\. The LISP family of languages encourages a style of functional programming
that eschews static type systems, relies heavily on macros and algorithms
involving singly-linked lists, and doesn't mind exposing the ability to mutate
state.

2\. The ML family of languages, of which I am the least familiar, are
statically typed, but are also OK exposing mutable state and do not track any
effects in their type systems.

3\. Haskell heavily pushes reliance on Monads, monad transformers, and
effects/state tracking through the above.

4\. Proof assistants and similar languages like Coq go beyond tracking effects
in the type system; they track values themselves, and essentially require you
to prove mathematically that your program is correct.

So, given the above, what do you mean by functional programming? From the
talks I've seen given by the creator of Scala itself, I believe he sees Scala
as fitting in with the ML family languages moreso than Haskell.

Also, the way Scala's type system and runtime currently work, I don't think
it's a good fit for Haskell-style programming. I tend to find monad
transformer-based code in Scala exceedingly ugly and difficult to read
compared to Haskell. The underlying runtime itself also has little mechanism
for optimizing monad-based code, whereas the GHC compiler has probably man-
years of effort spent into optimizing code using monads.

------
raystar
I used
[https://twitter.github.io/scala_school/](https://twitter.github.io/scala_school/)
to learn, I found it useful.

~~~
partycoder
That tutorial is good. But be mindful that in it there is no explicit
distinction being made when using Scala standard library types and Twitter
library types.

e.g: Futures used in there are from Finagle rather than
scala.concurrent.Future

~~~
rlau26
Just to add on to this incase anyone is wondering, Twitter has a library that
allows you to use the different futures together
([https://github.com/twitter/bijection](https://github.com/twitter/bijection))
if you need to.

------
rollulus
I started with Scala a year ago for work. I used a mixture of the resources
listed here, but I found this [1] series the most valuable, after the other
resources gave a basic foundation.

[1]:
[http://danielwestheide.com/scala/neophytes.html](http://danielwestheide.com/scala/neophytes.html)

------
wsargent
The Artima book by Odersky is the bible, and so you need that one.

For reference, I like
[http://naildrivin5.com/scalatour](http://naildrivin5.com/scalatour) although
it's 2.8 rather than the current 2.12.

For style guide, I'd go with Li Hiayo's blog, notably the Strategic Style
series:
[http://www.lihaoyi.com/post/StrategicScalaStylePracticalType...](http://www.lihaoyi.com/post/StrategicScalaStylePracticalTypeSafety.html)

------
mosqutopi
I read scala for the impatience, but once you know clojure, haskell, erlang
and other languages the scala language seems to be one more language, a better
java but nothing that really surprise you. I know that using scala you can
make your programs very difficult to read using obscure notations for
operators. I like to use scala as a repl for exploring java classes, a little
more useful that clojure in this regard.

------
gh0zt
As you are asking for books \- Scala for the impatient
([http://www.horstmann.com/scala/](http://www.horstmann.com/scala/)) \-
Programming in Scala
([https://booksites.artima.com/programming_in_scala_3ed](https://booksites.artima.com/programming_in_scala_3ed))

I found those books very good resources. The Scala website lists a few others
([https://www.scala-lang.org/documentation/books.html](https://www.scala-
lang.org/documentation/books.html))

Aprt from that I found Daniel Westheides blog a very good starting point
([http://danielwestheide.com/scala/neophytes.html](http://danielwestheide.com/scala/neophytes.html))

~~~
taway_1212
I learnt Scala from Odersky's "Programming in Scala" and can fully recommend
it. I didn't have any functional language experience beforehand.

------
rv11
If you want to learn "functional" aspect and not only library and syntax, I
would recommend SICP.

[https://mitpress.mit.edu/sicp/full-
text/book/book.html](https://mitpress.mit.edu/sicp/full-text/book/book.html)

~~~
ScalaNovice
How much of this book is "functional" aspect and how much is everything else?
Going through the TOC, it looks like the book tries to start from 0.

Would you recommend any particular sections for someone who's looking to only
understand the functional parts?

~~~
Philipp__
Your comment tells me you should start from the beginning and read the whole
thing. :)

Just give it a try. I was hooked after first chapter!

------
ohmygeek
Scala Cookbook:
[http://shop.oreilly.com/product/0636920026914.do](http://shop.oreilly.com/product/0636920026914.do)
(most of it is available online here:
[http://scalacookbook.com/](http://scalacookbook.com/))

Once you are done with this, you can pretty much pick any of the projects here
and start reading the source code:

[https://github.com/lauris/awesome-scala](https://github.com/lauris/awesome-
scala) [https://github.com/adamw/awesome-
scala](https://github.com/adamw/awesome-scala)

Reading code is the probably the best way to learn any programming language
IMO

------
partycoder
"Another tour of Scala":
[http://naildrivin5.com/scalatour](http://naildrivin5.com/scalatour) was
informative for me.

It's a bit dated, mostly targetting Scala 2.8. Current version is 2.12. But
should not be fundamentally different.

------
thelittlenag
I know this question is mostly about resources in dead tree format, but don't
forget there are sometimes local events and meetup groups that can help you
learn Scala (and other languages too!).

For example...

If you live in Dallas/Fort Worth and would like to learn Scala then you should
know that the local Scala Enthusiasts group is hosting a Scala Essentials
workshop on April 7th, 2017. This will be an all-day, hands-on event for Scala
beginners. We will start with a language intro and finish up coding a REST
server. More details can be found here: [https://www.scala-
enthusiasts.com/scala-essentials-workshop-...](https://www.scala-
enthusiasts.com/scala-essentials-workshop-2017-04/)

------
eb0la
I reccomend "Just Enough Scala for Spark" tutorial from Dean Wampler. It was
scheduled in Strata NYC, Singapore, and San Jose. Good part: practical. No
"weird" or "religion-like" stuff. Just get s __t done today.

It's archived in SafariBooksOnline: check
[https://conferences.oreilly.com/strata/strata-
ny-2016/public...](https://conferences.oreilly.com/strata/strata-
ny-2016/public/schedule/detail/51593) before applying to Safari just in case.

------
rathboma
If you're looking for books I recently made a list of good books for Scala -
[https://blog.matthewrathbone.com/2017/02/14/scala-
books.html](https://blog.matthewrathbone.com/2017/02/14/scala-books.html).

Otherwise Scala School is awesome:
[https://twitter.github.io/scala_school/](https://twitter.github.io/scala_school/)

When I worked at Foursquare we would send folks to the Scala School website as
homework. :-)

------
rlau26
[http://rerun.me/](http://rerun.me/)

This blog has some good articles on how to work with Futures properly as well
as some Akka stuff.

------
salmonfamine
I would recommend Introduction to the Art of Programming Using Scala:
([https://www.amazon.com/Introduction-Programming-Chapman-
Text...](https://www.amazon.com/Introduction-Programming-Chapman-Textbooks-
Computing/dp/1439896666))

It's very practical, however it approaches the language from a completely
novice perspective. If you have years of programming experience, it may be a
little redundant for you.

~~~
tinathefatwhale
Same

------
VeronicaHadley
You should check this
[https://www.tutorialspoint.com/scala/](https://www.tutorialspoint.com/scala/)
&
[https://bigdatauniversity.com/learn/scala/](https://bigdatauniversity.com/learn/scala/)

------
beastman82
I learned by reading "Programming in Scala" by Martin Odersky who invented the
language.
[https://www.artima.com/shop/programming_in_scala_3ed](https://www.artima.com/shop/programming_in_scala_3ed)

------
suls
I hope you don't mind me asking: Is there a specific reason behind you wanting
to learn Scala "properly"?

------
dominotw
piggybacking on this question. I am really struggling with sbt. Is there is a
good FP in scala equivalent for sbt that walks you through feature by feature
via exercises and examples .

~~~
scalatohaskell
Hi. Sorry I don't have a good answer for you, but check sbt docs, it's pretty
comprehenful, but it's not best.

Your best bet is to visit opensource projects and look into their build.sbt's,
how they do things -they're usually not big enterprise projects and you can
quickly 'get' how they setup what.

Always feel free to visir /r/scala and ask sbt-related question there, there
is active community happy to answer both sbt/scala/fp related questions.

------
emodendroket
I liked Scala for the Impatient but I'm pretty novice.

------
vram22
What's the market demand for Scala like?

~~~
runT1ME
Very good on the coast, high paying, fun work. Pretty sparse otherwise. I'm
sure there are exceptions, but it does seem like it is growing. And,
ironically, the main reason companies cite not choosing Scala (or only dip
their toes into Scala) is lack of Scala engineers.

~~~
vram22
Interesting, thanks. I suppose companies on the coast may tend to be more open
to new stuff.

------
Larrikin
If you aren't leaning Scala for work or a specific project that requires it ,
have you considered Kotlin? I have found the language much more productive in
my day to day, after initially discovering Scala and digging deeper.

