Ask HN: What are some books where the reader learns by building one project?

813 points by kyoob ↗ HN
I'm about halfway through 'Build You Own Lisp' and I'm really enjoying it. Each chapter builds on the last by adding something new to the same project (and thereby explaining some new concept). I find that the books I'm least likely to bail on are the ones that lead me through the building of one big project like this. What are some of the best titles in this little subgenre?

231 comments

[ 2.9 ms ] story [ 274 ms ] thread
Physically Based Rendering – From Theory to Implementation doesn't necessarily have the reader build a project, but it explains its reference implementation very well, and you could go ahead and write your own in parallel based on it. http://www.pbrt.org/
Programming Phoenix Productive |> Reliable |> Fast. It goes through building a website that starts from the beginning and goes up to Phoenix Channels (websockets) for a real-time video streaming application that lets users comment on the video at specific times and it is broadcasted to all other users.
How advanced is this? I'm a beginner Rubyist with some Rails experience and have been interested in trying Phoenix out but I'm not an experienced web dev by any means so the web socket stuff is a bit intimidating.

Does it walk through the basics will enough? Or will I have built something with no idea how it actually works?

Not that advanced. It does walk you through the basics; you should be able to work through it and understand what you've built and how it works (it emphasises and explains the lack of magic). + You should be able to build something pretty easily without ever having touched Elixir before; the book builds up your knowledge very steadily.

I would say maybe, from a language/syntax point of view pair it with "Programming Elixir", which is a good introduction to the language, again going through the concepts of it and building them up well - the Phoenix book goes pretty quickly over the language constructs, just giving you them when needed to understand how Phoenix is doing stuff.

The book assumes a base level of knowledge about programming in general, and some knowledge of how web applications work. However it does cover a lot of the basics - I've got a decade or so of experience in the field and probably skimmed over 75% of the book while it discussed concepts that are familiar to me.
Michael Hartl's Rails Tutorial (https://www.railstutorial.org/) leads you through Ruby, Rails, Git, and deployment to Heroku through two very small projects and one related larger project that takes up the bulk of the book.
Professional Java for Web Applications. If Java is your thing.
Orchestrating Docker.

I don't know if it's one of the best, but it teaches Docker concepts with a single project, and as you progress through chapters, you will find different ways you can deploy applications using Docker containers.

https://www.packtpub.com/virtualization-and-cloud/orchestrat...

I know India's a big place but it's a bit of a coincidence that you and the author are from the same city ;)
Oh! I'm sorry. I forgot to add the disclaimer, and can't edit the parent comment anymore. I'm the author.
Is it possible to read the first chapter for free so that I can decide if I want to buy the book or not. There almost no reviews of your book.
Yes. You can download a sample chapter from the aforementioned link
Thanks, I didnt see that button on the site.
I really liked The Elements of Computing Systems (nand2tetris). The reader gets to build a computer from nand gates up.
Modern Compiler Implementation in ML by Andrew Appel
I second this. Build a compiler from scratch. Main annoyance is that it uses SML - most readers are likely to want to use OCaml, and it's a bit fiddly translating between the two.
Why not just work with SML and focus on the compiler building part? Any particular reason to want to use OCaml?
This looks awesome. Might be a fun way to help my kids learn CS once they're old enough.
You're fooling no-one, Shimon... ;)

Just a joke: the course is by Noam Nisan & Shimon Schocken

The accompanying book is "The Elements of Computing Systems" and Part 1 is available as a course on Coursera. I highly recommend it; just finishing the Coursera course myself and I'll definitely be doing Part 2.

I'll second this. I worked through the book and downloadable exercises a few years ago. It's a great way to learn about the multiple layers of abstraction that a modern program sits upon.
Ha! This is one of the few times in my life I can honestly say no, that's a different Shimon.
On a similar topic but a bit less project oriented:

Charles Petzolds "CODE The Hidden Language of Computer Hardware and Software"

http://www.charlespetzold.com/code/

100% yes.

I started with Elements of Computing: creating a half-adder and then a full-adder chip. But, I couldn't understand how I reached my solution—I was relying on my intuition. Then, I started reading "Code", which takes the reader on a journey from shining flash lights to communicate with your neighbor, all the way to bridging the gap between boolean algebra and building a relay.

I had an interface electronics course back in the day that was like this.

Bandit Algorithms book is sort of like this. starts out simple and touches different methods

Michael Hartl's Rails tutorial (https://www.railstutorial.org/) is a great example of this.

It'll run you through building a twitter clone and introduce you to git, heroku, a bit of CSS/HTML, and even goes into AJAX a bit.

I can't recommend it enough to people looking to get into rails.

I am interested in the heroku part, but I would like that for different services. Like Amazon, Digital Ocean (I used it for single VPS but I'd like to see how to set up different vps, connect with each other, do vertical and horizontal scaling, etc).

Any recommendations in this area?

Packer + Docker + custom cloud elastic stuff.

You can use docker compose and swarm but at some point you need to interface with how the cloud offering does elastic scaling (for example google has instance groups and deploy templates).

I haven't seen a good resource on this last part other than PaaS/IaaS doc itself. So I am curious as well.

There sort of needs to be a packer of deployment + composition but I suppose that is what chef and puppet are sort of for (I despise those tools).

Not only that, but for me what was super helpful was the "this is how real developers would approach this" in terms of covering lots of workflow things, design patterns, Git, unit tests, setting up your dev environment, sprucing it up with some gems, etc.

Can't recommend it enough.

I love that book and recommend it to anyone. The only thing I don't really like is its focus on MiniTest when practically everyone in the Ruby ecosystem has moved to RSpec. If I had to find a reason for this choice I'd say, one less gem to install and configure, and again convention over configuration.
I think MiniTest is a good starting point even if you end up going with Rspec, as MiniTest/jUnit style testing feels a little bit lower level. In the same sense, the book implements authentication from scratch, whereas many apps will end up using a library like Devise.
> I don't really like is its focus on MiniTest when practically everyone in the Ruby ecosystem has moved to RSpec

Is this true? I know RSpec is the popular one in open source, but last I checked the two were still pretty even as far as big name recommendations. I used to believe RSpec was the default when I first started Rails development, but as a professional dev I had seen plenty of Minitest implementation.

It's been a while since I went through it, but did the tutorial not originally use RSpec, then switch it out at about version 4 (along with a few other tools) so that everything in the book made use of the most basic, out-of-the-box tools (as much as possible)?
is there something similar to this but for python based frameworks, or javascript based? Seems like every great tutorial / books that I find are using ruby
Django has good tutorials, I don't know about building "one app" though. I'm sure you can find some of lesser quality; Hartl's tutorial is one of the very best.

If you don't mind drawing out your learning process, you could walk through Hartl's tutorial and do the equivalent in Python (probably with much help from google). So you couldn't use his code examples, but you could set up the same DB structure, the same types of tests, etc, and hit all the important parts of the web dev process.

Edit: found this in another comment below. Just thought I'd include it in case you gloss over it! https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial...

For what it's worth, it's fairly agnostic when it comes to languages or frameworks. Yes, you'll learn Rails, and some Ruby on the way, but the intent is to learn web development from the ground up. You'll learn concepts that will apply to anything else you might be using. It's invaluable, and a great place to start with web development.
Django Unleashed is written as a step-by-step guide to building a single Django project. The link below has links to Amazon or to Pearson's own site (DRM-Free!).

http://django-unleashed.com/

Full Disclosure: I'm the author.

If you're looking to go nuts, I recommend reading the first twelve chapters of Django Unleashed, following it up with Harry Percival's Test Driven Development with Python book (also written as a step-by-step guide), and then finishing Unleashed.

http://chimera.labs.oreilly.com/books/1234000000754/index.ht...

Two Scoops of Django (not a guide) is great to have after that.

https://www.twoscoopspress.com/products/two-scoops-of-django...

Hope that helps!

This is also the first thing that came to mind for me. One of the finest web dev tutorials ever written.
I loved it so much that I bought the movies just to make sure he earned something from me for such an extraordinary piece of work.
This is the inspiration behind the book I am working on - Web Development with Go (see https://www.usegolang.com).

Michael's book is fantastic and I really wanted something similar for people getting into go. My book doesn't cover git or testing but that is because rails is a framework with tons done for you, and in my book you basically build all of that from scratch. You learn a ton, but it is long and adding git or testing would have made the book like 600 pages (instead of ~400ish).

If you are interested in Go I'd love to get your feedback :)

I subscribed to your blog and your newsletter some months ago, and I must say I like what you do. Although I'm focused on C++ now for some courses I'm taking, I still hope to catch up on Go later, and I think your book will be helpful. Personally, I wouldn't mind a hands-on exploration of a programming language having some pages, and links to good resources, on version control. Learning 'git' in such practical way (as part of a project) seems better to me (Harvard's CS50 now takes that approach too: https://github.com/blog/2322-how-cs50-at-harvard-uses-github...).
Feel free to email me if you want to discuss this in more detail. I'm not opposed to something like this but I suspect a video format may work better. jon@calhoun.io
I've been planning to get into Go so the book looks interesting. One question though: How far into the book do you introduce tools for automated testing?
This book doesn't cover testing at all. I wanted to, but there just wasn't room for it and it would have lead to information overload.

What I am thinking about doing is writing a companion book that covers git, testing, etc. Eg after every chapter the companion book then walks you through writing tests, committing to git, merging it into master, etc. That way someone could optionally choose to do those things along the way. I might also experiment with other formats, but time will tell.

That's a really cool idea, to build a clone of the framework you're trying to learn. Thanks for the link.
There needs to be more books like this, but I imagine the lack of such material is due to the effort needed to break a framework down into its smallest pieces.
I loved this book. I only read parts of it, but the section on $scope and the digest cycle gave me such an awesome lightbulb moment.
Not a book but Casey Muratori's Handmade Hero series is really interesting. It's a from scratch tutorial on building game in C on windows but delves into many interesting programming topic that would be useful outside game development.

https://handmadehero.org/

Code by Charles Petzold takes this approach to explaining how a computer works. By the end he has a working system with CPU, RAM, inputs, and outputs.
Eloquent Javascript - http://eloquentjavascript.net/

You build 5 projects through the book - a programming language, paint program, a dom game and a skill sharing website using node js.

Added bonus: beautiful typography.
For anyone who hasn't read this book, it's great, but very much an intro-to-programming book, at least for the first 6-or-so chapters.
Automate the boring stuff - Al Sweigart.

This book teaches you python through a series of example projects. You can get it online or order a physical copy and help support the author here:

https://automatetheboringstuff.com/

Anything by Manning that ends with "In Action". I volunteer to be a technical reviewer if there is a new technology I want to learn (and get a free physical book!)
How did you get started as a technical reviewer?

I love reading technology books. It would be great to get early access and be able to talk to the writers directly.

You can either ping existing authors or hit up the publishers. Squeaky wheel gets the grease. They're always looking for folks.
I dunno why, but I was kind of hoping there would be non-CS answers for this too, like how to woodwork, or like tying flies.
I think there was a wood or metal working one above.
Seems reasonable. I was hoping to see a few more, too! Only mention of the scrap metal project so far.
I was hoping someone would ask this. The question made me think of 'Rebuilding the Indian' by Fred Haefele. In an autobiographical work, the author gets respite from and perspective on his emotional issues by focussing on rebuilding an antique motorcycle.
The Build Your Own Metal Working Shop from Scrap series by David J. Gingery.
Damn! Bookmarking that for once I get a house with enough space.
The series is certainly worth reading for the learning, but actually doing it? Don't bother. The books were written when hobby-level machine tools were very expensive. In these days of cheap Asian imports, it's not worth building your own from DIY castings unless you're doing it for fun.

I will say that the first book (metal casting) is very useful, because you can learn to make aluminum castings easily and then machine them on your cheap import/worn out old American Iron.

Would anyone do it but for the fun? I thought that was the whole point.

It's on my todo list. Never enough time, but I've got a little forge already, at least!

No, when the series was written the point was the tools, not the process. Back then a hobbyist metal lathe or shaper was pretty expensive, and this was a low cost way to get one.

These days, not so much.

Yeah, it's a ton of work. I never got past the metal casting.
Is there something similar for woodworking?
I haven't bought or started this yet, but this book on interpreters is on my todo list: https://interpreterbook.com/
This is an excellent book. It's a great follow-on to the book mentioned by OP, "Build Your Own Lisp".
Pretty good book. I was a bit skeptical when I bought, but it was totally worth the price.

Strongly recommend it.