Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I didn't post this, but cool to see this up here!

The full book is ~400 pages and will be released Summer 2020 (i.e. soon!). If you're interested in being notified when it comes out, there's a mailing list link on the page and I'll let you know when it's out. There will be both E-Books as well as paperbacks & hardcovers (assuming the supply-chains are still open in this COVID-19 global environment...)

The first 5 chapters are already online, for free now and forever. These form a self-contained introduction to the Scala language: setup, basic syntax, collections, and a notable language features. If you're looking for a quick introduction to Scala, this is it.

The rest of the book goes heavily into use cases and projects in a way that few other programming books do: interactive websites, network file synchronizers, programming language interpreters, migration tools, parallel web scrapers, and much more. The book intentionally skips a lot of language esoterica in favor of showing how to use Scala to do things someone might pay you a salary for.

You will learn Scala by building a breadth of useful experience, rather than a depth of knowledge in language minutiae.

The chapters in the book are all based on real projects I have worked on. Most projects take <100 lines of code (i.e ~2 printed pages), and it is a testament to the Scala language that we can build working prototypes of all these things in a single 400-page book!

If this interests you, feel free to leave your email on the website, and browse through the free chapters already available.



I can vouch for lihaoyi. He is one of the more prolific people in the scala community writing top notch stuff. The best part about most of the stuff be writes is they are extremely ergonomic, even by scala standards. Look at either scala-tags or even better his parsing library. The parsing library is actialy so good you'll feel like finding more problems to solve. Its a breeeze to get started with (even in repl). Scala-tags also is amazing and has spawned other similar projects , one of which is laminar which is currently one of the top scala-js frameworks.

In fact I can probably say this for a lot of his work, anyone learning from him would probably learn a user centric way of library design.


Glad you like them! The reason Scalatags is so good is that it is my 7th iteration of a HTML templating library: starting from using XHP at work, I had written my own templating libraries in PHP, Python, C#, F#, and 2 others in Scala before settling on the Scalatags style a few years ago that is basically unchanged today.

Given how much work I’ve obsessively put into that effort over many years, the final library damn well better be good to use!


[flagged]


I can tell you if this were true he wouldn't be programming a language that has to deal with jvm.


Lots of people from good families work in JVM backed solutions as a choice, I understand that this might come as a shock.


That is what Google implies...unless they just share names, universities, and ages.


As someone who really like reading your blog articles, I'm super happy to see this :) I'll probably purchase it, as a part of my strategy to make my friends and colleagues start scala :) I'm looking forward to a "advanced scala programming" follow up ;)


Haha one step at a time. First I need to finish this final round of reviews and edits to get this manuscript out the door!


Looks like Scala instead of OCaml is in my next language to learn.


You should! Been coding in Scala in my day job for the past 5 years, and it’s a great language - my personal favourite. Elegant/beautiful AND practical. The mix of OOP, FP, really robust static type system, and great 1st class concurrency support is a direction most languages are moving in, and Scala already nails it. There’s a significant learning/ramp-up period, but it’s good learning that helps your programming in any language, and once you start getting comfortable with the language you become quite productive.


I agree. I've used both heavily, they are both amazing, but Scala nowadays has a much richer ecosystem of libraries (because of the JVM heritage). Nevertheless, they are both in the ML tradition of languages, and once you've mastered on, the other is easily picked up.


Will the ebook be released before the physical version? This is EXACTLY the book on Scala I've wanted and am so excited to see this coming!


I can’t really promise the “before”, but the e-book will be released when the current round of review and edits is complete. The physical books released when I can figure out the logistics of printing and distribution


Speaking as an Nof1, if you were to do an early access release like Manning does with their MEAP books, I would go for that.


This is very cool, I love the idea. How does the book handle Scala 3?


It doesn't for now, and doesn't really need to. Scala 3 isn't out yet, and when it is there will be a migration period (as always) while things will remain backwards compatible and libraries will remain cross compiled.

This book also explicitly skips over all the deep language esoterica, in order to focus on use cases. As a happy consequence, I expect ~all code samples to continue working unchanged in Scala 3 for the foreseeable future.


Will this be a good book to learn your first functional language?


Yes!

We use a lot of functional techniques in this book, but we do not dwell on them. In the end you will be using functional techniques not because they’re interesting, but because they’re the obvious and easy. That is how functional programming should be!


Functional programming is a style or pattern. If a language gives you basic stuff, you can do that pattern.

I learned a bit of haskell a long time ago - mind blown kind of time - then found javascript had closures (erm, kind of a way of turning functions into objects-with-state-that-still-look-like-functions) and functions as first class objects (meaning a function can be passed around exactly like and integer or a string) and so I used it in javascript. Google up "javascript functional" and see what happens. Do some exercises.

Beware there are libraries out there that make simple functional Jscript stuff look entirely unnecessarily complicated.

And when you're ready, pick up this guy's book!

Edit: that may have come across a bit insulting towards the author. All I'm saying is you can learn the functional stuff while you wait for the book to come out. And when you have the functional stuff under your belt, get the book and you'll be one large step better prepared to dive into it - scala has a lot more to offer than just functional programming, and the book will surely cover a lot of ground.


> Functional programming is a style or pattern. If a language gives you basic stuff, you can do that pattern.

Kind of... correctness isn't as guaranteed though. Having a hard time putting it into words at the moment, maybe I just need some holes poked into it to draw out the rest of my view (or change it).


Regardless of how good a book may be, I think Scala itself might prove to be a challenging language to learn FP through. I use it daily at work and definitely appreciate all its strengths, but I don't think I'd ever really understand it if I hadn't studied Haskell first. I'd recommend it as a second language, after you've been bitten by the bug and want a job writing functional code.


Hiya, found a typo - couldn't see where else to mention it so adding here, maybe the author will notice.

Ch 3.

This chapter will not covering any Scala-specific

should be: This chapter will be not covering any Scala-specific

Otherwise enjoying what I've read so far. I've just been dropped in at the deep end of a project with no scala experience, so I'm trying to get off the ground asap.


Well that was totally wrong.

should be: This chapter will not be covering any Scala-specific


Could you compare your book to ``Scala for the impatient´´?,


Sure! I have the table of contents for "Scala for the Impatient" open in front of me:

- S4tI goes into a lot more detail into language features: custom extractors, abstract overrides, annotations, higher kinded types, custom operators. Hands-on Scala skips all of that. Most developers do not need to know this stuff to get stuff done professionally.

- Hands-on Scala spends its pages working on fun use cases instead! As far as I can tell, S4tI doesn't cover use cases at all. Sure it's great you know about structural/compound/existential types, but it's setting up webserver, mangling a database, or scraping someone's website that gets you paid a salary.

- S4tI is a bit out of date (at least the preview copy I have) and covers things like Delimited Continuations, XML processing, and the scala-parser-combinators and scala-actors libraries which you shouldn't really be using any more

- S4tI doesn't really use third party libraries AFAIK; that means things like working with files uses the `java.io` or `scala.io` APIs, which are strictly worse than the modern alternatives. In fact, it is only due to the modern collection of libraries such as Requests-Scala, OS-Lib, Cask, Quill, etc. that allows Hands-on Scala to cover as much ground as it does in a tiny amount of code. Hands-on Scala leverages this ability to the fullest!


Thanks a lot, insightful. It seems the Hands-on is very appropriate.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: