Hello, I've started to work with scala and I think it's a beautiful language. that said, I'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's use in production?
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/
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.
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!)
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.
Advanced Scala appears to be just what I'm looking for. According to Gumroad it's in Early Access -- are you able to advise on when you're hoping to publish the final version?
I see from browsing the TOC that some topics are out-of-date (Xor.)
In this particular case the TOC is out of date. We released a version of the book compatible with Cats 0.9 (including Either and removing Xor) a few weeks ago.
Final version should be out last half of this year.
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.
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.
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). 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.
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.
That book is by far the best one I ever read about Functional Programming in general, even if you don't want to learn Scala itself it is an amazing reading about FP.
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.
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.
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.
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.
>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.
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.
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
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) if you need to.
This is really old at this point. IIRC it's for Scala 2.9, so there's stuff that's since deprecated (view bounds) and features it doesn't cover (implicit classes).
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.
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.
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-...
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 st done today.
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.
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 .
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.
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.
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.
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... and the source is at https://github.com/underscoreio/creative-scala/