8 ms·
Ask HN: What are the best resources to properly learn Scala?
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?
- vasshu 10y agoThere is a course on Coursera thaught by the Scala creator: https://www.coursera.org/learn/progfun1 https://www.coursera.org/learn/progfun1
- gingerbread-man 10y agoIt'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 10y agoI 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.
- raystar 10y agoI used https://twitter.github.io/scala_school/ https://twitter.github.io/scala_school/ to learn, I found it useful.
- partycoder 10y agoThat 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 10y agoJust 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.
- Dawny33 10y agoThis course is super good! I also made some brief notes (not complete though), from this course: https://github.com/Dawny33/Notes/blob/master/Programming/Scala/Learning.md https://github.com/Dawny33/Notes/blob/master/Programming/Sca...
- saryant 10y agoThis 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).
- gh0zt 10y agoAs 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 10y agoI learnt Scala from Odersky's "Programming in Scala" and can fully recommend it. I didn't have any functional language experience beforehand.
- ohmygeek 10y agoScala 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 10y ago"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.
- rollulus 10y agoI 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
- SatvikBeri 10y agoI found Functional Programming in Scala to be the best source: https://www.amazon.com/Functional-Programming-Scala-Paul-Chiusano/dp/1617290653/ https://www.amazon.com/Functional-Programming-Scala-Paul-Chi...
- bontoJR 10y agoThat 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.
- jibitesh 10y ago+1 for this The best book for how to use Scala. It talks about not just how to use FP, but also why to do it and the best practices.
- nrinaudo 10y agoI 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.
- VeronicaHadley 10y agoYou should check this https://www.tutorialspoint.com/scala/ https://www.tutorialspoint.com/scala/ & https://bigdatauniversity.com/learn/scala/ https://bigdatauniversity.com/learn/scala/
- Larrikin 10y agoIf 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.
- fuck_google 10y agoCould you explain why Kotlin is more productive for you?
- rlau26 10y agohttp://rerun.me/ http://rerun.me/ This blog has some good articles on how to work with Futures properly as well as some Akka stuff.
- rv11 10y agoIf 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 10y agoHow 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__ 10y agoYour 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!
- rv11 10y agoatleast go through initial 4 chapters. then go through the coursera lecture of Odersky. Though SICP is lisp, the structure is very similar to scala.
- emodendroket 10y agoI liked Scala for the Impatient but I'm pretty novice.
- noelwelsh 10y agoI'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.pdf https://dl.dropboxusercontent.com/u/8669329/creative-scala.p... and the source is at https://github.com/underscoreio/creative-scala/ https://github.com/underscoreio/creative-scala/
- pc86 10y agoI'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 10y agoTeam 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.
- mosqutopi 10y ago
- deleted 10y ago[deleted]
- beastman82 10y agoI 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
- scalatohaskell 10y agoDepends 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 10y agoUntil you try clojure or even kotlin
- scalatohaskell 10y agoI 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 10y agoThere 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 10y agoI 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.
- sreque 10y agoI 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 10y ago>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 10y agoIn 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.
- mosqutopi 10y agoI 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.
- thelittlenag 10y agoI 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-2017-04/ https://www.scala-enthusiasts.com/scala-essentials-workshop-...
- wsargent 10y agoThe 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/StrategicScalaStylePracticalTypeSafety.html http://www.lihaoyi.com/post/StrategicScalaStylePracticalType...
- salmonfamine 10y agoI would recommend Introduction to the Art of Programming Using Scala: (https://www.amazon.com/Introduction-Programming-Chapman-Textbooks-Computing/dp/1439896666 https://www.amazon.com/Introduction-Programming-Chapman-Text...) 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 10y agoSame
- dominotw 10y agopiggybacking 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 10y agoHi. 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.
- suls 10y agoI hope you don't mind me asking: Is there a specific reason behind you wanting to learn Scala "properly"?
- eb0la 10y agoI 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 archived in SafariBooksOnline: check https://conferences.oreilly.com/strata/strata-ny-2016/public/schedule/detail/51593 https://conferences.oreilly.com/strata/strata-ny-2016/public... before applying to Safari just in case.
- vram22 10y agoWhat's the market demand for Scala like?
- runT1ME 10y agoVery 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 10y agoInteresting, thanks. I suppose companies on the coast may tend to be more open to new stuff.
- rathboma 10y agoIf 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. :-)