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

852 points by Shosty123 ↗ HN
A continuation of https://news.ycombinator.com/item?id=13660086 which has been incredibly useful to me.

I recently finished this phenomenal book called "Building Enterprise JavaScript Applications":

https://www.packtpub.com/web-development/building-enterprise-javascript-applications

Which takes the reader from zero to building a non-trivial production fullstack application with JavaScript. I also recommend "Building Git". The title is self-explanatory:

https://shop.jcoglan.com/building-git/

Other resources:

https://github.com/AlgoryL/Projects-from-Scratch

https://github.com/tuvtran/project-based-learning

187 comments

[ 2.0 ms ] story [ 268 ms ] thread
I found Paradigms of AI Programming (https://en.wikipedia.org/wiki/Paradigms_of_AI_Programming) an amazing book to work through.

It takes you through implementing some classic AI examples (such as Eliza) and teaches you how to write code in a data-first style through Lisp.

I worked through the whole thing building it in Clojure and learnt loads (not just about AI, but about writing readable code in general). I can't recommend it highly enough!

Yes, it really teaches both good Lisp style and the history of AI.
Frank Luna's Introduction to 3D Game Programming with DirectX 11 is an underrated gem in the genre. I was surprised when I saw Microsoft recently recommending it to people to learn D3D11 before they jump into D3D12.

It doesn't actually cover game programming per-se, it's more of an introduction to 3d graphics programming book, but each chapter builds upon the last and there are assignments at the end of each chapter that allow you to play around with concepts that he walks you through so you can build a good understanding.

I've seen other books that are often recommended, and they're great by themselves, and they are nowhere near as utilitarian as this book. I cannot recommend them to beginners even if they're marketed as such.

By the end of it, you have a very good handle on a variety of concepts that you can readily apply towards, say, building a modern-day PBR pipeline.

It was my first exposure to spaced repetition learning, before I knew such a thing existed.

I have never read it but how is SRS incorporated into it?
It took me awhile to get through the whole book, so the concepts that were covered by chapters I had read weeks or longer ago would every so often make a come-back in the proceeding chapters. The timing and repetition of it all reinforced and helped me in learning it for years to come.

There are a lot of "good" books on graphics that jump you from one topic to another but never really integrate what you learn or ask you to take something covered earlier, but now combine it with a newly-learned concept to create something novel (novel in the eyes of a beginner). We need more books that integrate, because a lot of very recent (as of SIGGRAPH 2019) graphics development is about taking a set of concepts you already know, and exploiting them in different ways.

This is a great series of books (he has essentially the same book for early DX9, DX9 with shaders, and DX12). Particularly if you want to learn DX12, going through the DX11 book first and then the DX12 book is great because you can really see where things are different.

I wish that there was an equivalent for learning OpenGL or Vulkan.

There are some really cool projects in the "500 Lines or Less"[0] book which is a part of the "The Architecture of Open Source Applications" series.

[0]: http://aosabook.org/en/index.html

This is a really cool recommendation, thanks! Very inspirational for side projects.

It would be cool to see something like this for data science projects. Like a recommender system in 500 lines or less.

I liked "Deep Learning and the Game of Go" (by Max Pumperla and Kevin Ferguson). You actually create an AI Go player, one which may not be quite on the level of AlphaGo, but one that is probably better than any traditional min-max based player that was the state of the art until recently.
I skimmed that book. I already knew some machine learning and AI techniques, so it was a bit to verbose for me, but was a good book.

I never did get a working Go AI though. I'm a Go beginner and never created an AI that was close to challenging to me. I didn't follow the book exactly though, I did my own thing loosely guided by the book, so my failures do not necessarily reflect poorly on the book.

Did you ever get a working Go AI?

Elements of Computing Systems by Nisan and Schocken has you 'build' a computer from basic logic gates to CPU/Memory to assembler, VM, etc. all the way to a running program.

https://www.nand2tetris.org/

This book was amazing since it had you starting at the transistor level, building gates, components, the entire CPU/RAM, ASM, and finally building a mini OS to run on the entire platform.

Could not recommend enough.

I recently read Code by Charles Petzold and it quickly become one of my favorite books, this seems like a great follow-up
That book is amazing. It inspired me to look for more resources on computer architecture and Verilog, and after a while I had a very simple but functional CPU in Verilog that can compute prime numbers [https://github.com/f00zz/rei].
Glad to see this here. Really took away a lot of the "magic" that intimidated be about the lower level operations of computers.
I was here just to add this book if not added.
The online course that I took made a college class on logic gate echelon stuff an absolute cakewalk to me, and fully familiarized me with a lot of the concepts in "the hard way" (doing it), so that I was ready to learn the tips and tricks later. I cannot second this recommendation enough.
(comment deleted)
Black Hat Go -- Excellent book!
I'm interested in getting this book. What are the things you liked about it?
It's pretty practical so far. Right now I'm just finishing up chapter 4 (HTTP Servers, Routing, and Middleware), so I haven't completed all of it. But as it stands, a lot of what you go through, you reasonably expect you may be able to use on an actual pen test. The real power though, is when you're building out your own tooling with these things.

You just set up a framework in the book, but this is all easily extendable to whatever you want. I'm not the best at Go, so it's a useful "nightly devotion" of time to spend working through it for an hour or so.

I've also been going through Writing an Interpreter in Go, and have picked up the companion to that Writing a Compiler in Go. So far, that's pretty good too, but I'm focusing on Black Hat Go first, to complete it.

Thank you! I read a little bit more about it and I think I'll give it a Go ;)
I don't know if linking to one's own work is considered gauche here, but since it fits with the original question, my own book Practical Microservices fits this description (https://pragprog.com/book/egmicro/practical-microservices). It takes the reader from inception of a projection to a functioning system, explaining the basics of microservices, event sourcing, and CQRS along the way. Each chapter builds on the previous ones.
Embedded Systems: Introduction to Arm® Cortex™-M Microcontrollers

It's a pretty good introduction to embedded programming, with several projects included. Valvano's course at University of Texas is also available as a MOOC.

Structure and Interpretation of Computer Programs, where the reader implements a Lisp
Not quite what you're talking about but the best book on car mechanics I ever read... It was red, and textbook-sized, hardcover. Lots of drawings.

It literally started with an explosion in a can, and then progressively enhanced that idea step-by-step: add a lid to the can to capture the energy, add a lever to keep the can lid from flying away, and then attach the lever to a wheel so that it returns the lid to the top of the can for another explosion, add walls to guide the lid, ta-da! Piston.

It goes on like that, adding each piece of the puzzle in a logical way, until you have a mental model of an internal combustion engine. You definitely feel like you could build one from scratch (if you had the metallurgy skill.)

Boy if you could find the name of that book I'd really appreciate it
I would second this.
you might be interested in howacarworks.com. I stumbled across these videos on youtube earlier this year when I was researching the topic. I was unwilling to pay because it was more for my own curiosity than an actual need to learn but it seemed pretty thorough.
Man, that site has come a LONG way in the past couple of years. I haven't seen it since probably 2015. Back then, the diagrams were super useful, and the content easily understandable. Now it looks like a Mechanics University!
I would love to know the name of this book, sounds perfect for learning about combustion engines.
I'm hoping someone else remembers it and furnishes the title.

I was a kid when I read it, and the book was already old, so publication date circa 1970-80. Best I can do. I trawled through book cover images but no love.

- - - -

edit to add: It's probably "Auto Mechanics Fundamentals" by Stockel. I'm still looking for pictures of the insides of the book, but going by what I can see here, it's very likely:

https://archive.org/details/automechanicsfun00stoc/page/n5

The typography matches my memory, and the description in the introduction sounds spot on, eh? Cheers!

Internal Combustion Engines by Ganeson
(comment deleted)
How Cars Work by Tom Newton OR Auto Mechanics Fundamentals by Martin T. Stockel

Maybe?

I just previewed a few pages from "How Cars Work", and it listed this 'money saving tip' that I found pretty funny: "Don't ... make eye contact with police officers while driving"
Just going by description and the "red book" it seems like its Auto Mechanics Fundamentals:

>>> "It is the aim of Auto Mechanics Fundamentals to provide a thorough understanding of the design, construction and operation of automotive units. Each unit is approached by starting with basic theory, then parts are added until the unit is complete. By following this procedure, the function of each unit is explained, and its relationship to the complete car is made clear. Hundreds of illustrations were drawn especially for this text. Important areas are featured in these drawings, and many are exaggerated to place emphasis on parts being discussed. Unfamiliar words are defined immediately following the words. In addition, the Dictionary of Terms in the back of the book defines more than 1,100 terms..."

https://www.amazon.com/Mechanics-Fundamentals-Construction-O...

(This one is blue but there is another version in red)

Nice! My parents have this book, and I read some of it as a teen!
I bought a copy of "Auto Mechanics Fundamentals" based on this thread and I think it is definitely the book you're remembering. The exploding can image you describe is on page 9 and the first chapter builds up an engine from first principles like you've talked about. Thank you for recommending this, it's a great resource!
This is a transferable pedagogy. Want to learn a complex system? Start at the sources of the system graph and make your way to the sinks.
Commenting to save this one.
+1 - I want to come back to this thread and read things.
If you want to save for the future, you can just "favourite" the comment. If you don't see the favourite link, click on the timestamp to see the comment in its own page, and it should be there. You can also favourite the whole thread.
(comment deleted)
There is a great WW2-era training film from the US military on how rifles work.

Don't want to link it as I am at work, but it's on YouTube.

It follows the same philosophy--start with a tube. Add a bolt. Add a trigger. Add a magazine. Etc.

My book from O'Reilly ("Building Tools with GitHub") builds a variety of applications using the GitHub API in five different languages (Ruby, JavaScript, Python, C#, Java on Android). All the chapters build a complete project (app on Android for writing blogs with Jekyll for example).

You can buy it or read it free online (thanks again to O'Reilly for allowing us to release it under creative commons):

https://buildingtoolswithgithub.teddyhyde.io/

No prior experience with the languages are required, so it is good for a beginner wanting to dip their toes into that language and/or facet of the API.

A Curios Moon - a data science mystery that teaches you PostgreSQL by working on projects that use real nasa data sets in a fictional setting (your role as a data science intern at red:4)

https://bigmachine.io/products/a-curious-moon/

This is really nice book. It assumes you are a developer/good with computers, though, so some of the things like dev environment setup are ommited
As it should be; I dislike when books are dogmatic a out setup. Those pages are usually out of date at by the time the book is in print.
Does it assume I know SQL though?
No, you can start with absolutely zero knowledge, but it has different approach than usual courses.

You don't start with simple selects, but importing data from files and normalizing it. You're intern at aerospace startup after all.

I'd say it's _refreshing_ compared to prevalent approach to teaching SQL

I'm currently writing a book for PragProg called Building Distributed Services with Go (though it mostly applies to other languages too) that's walks you through building a distributed database from scratch. You can sign up on this mailing list to know when it's available: https://travisjeffery.us4.list-manage.com/subscribe?u=1e3ff7....
The link doesn't quite work there. But I'd be interested in signing up.
Thanks!
Any idea what your timeline looks like? I know a lot of PragProg books do beta books occasionally.
Yeah I'm discussing with my editor now about when to put out the beta it'll be out either after we finish editing the chapter I just finished writing or the next one. So pretty soon. I hope to have the whole book finished by July but that's a bit more TBD up to how soon I finish writing the last few chapters.
Well, I'm interested and will purchase this.
1. that link returns a 404.

2. Do you have a TOC or expected date for this to be out? Extremely interested!

Physically Based Rendering is basically a complete guide to building a modern physically based rendering engine (it even won an Academy Award)

https://pbrt.org/

I've been making my way through "Writing an Intepreter in Go" and "Writing a compiler in Go" https://interpreterbook.com/

The Go stuff is really just a means to an end, the real value comes from the practical learnings of how to build a functioning interpreter and compiler (and virtual machine!) for a programming language the author made up called Monkey.

It's not a book full of theory but it lays some nice foundations that might help you understand the theory better :)

On a similar note, Go Programming Blueprints, which just takes you right into practical affairs - project organization, template loading / rendering, a little bit of testing, REST apis, oAuth, image handling (via oauth, gravatar and file upload), databases, CLI's, external APIs, App Engine, microservices, gRPC and Docker. The main gripe I've had with it so far is that the bit of HTML / JS that is in there seems rather dated, but on the other hand, it's good old jquery from CDNs instead of bothering the reader with setting up nodejs, webpack and all that.

I really should kick myself up the arse and go beyond chapter 3, I'm doing Go in a real project now.

Go Programming Blueprints is from 2015, have you had any issues with it feeling out of date?
On similar topic, back in school we followed "Modern Compiler Implementation using ML" by Andrew Appel. Pretty good book, which teaches good amount of theory, but also has a project where you implement pieces of compiler as you progress through the book. Its fairly challenging, as you will generate assembly (MIPS) instead of just interpreting and apply various optimizations (and register allocation) in the end.

Its not exactly from scratch as there is some boilerplate code to keep you focused on concepts. It was quite fun, except I didn't really like working with SML (OCaml would have been nicer IMO, and I think you can choose to use that by finding the ported boilerplate on Github). Also has C and Java versions of this book.

Already mentioned in the first thread, but "Crafting Interpreters" is excellent.

In the first half of the book you write an interpreter for a simple scripting language; in the second half of the book, you write compiler to bytecode + vm.

Very clear, fun, excellent writing. Highly recommended.

It was also kind of amazing to very quickly have something that ran more quickly than python!

* The Rails Tutorial - https://www.railstutorial.org/

This book (although an older edition) is largely what got me into programming, and taught me so much about Rails.

* Programming WebAssembly with Rust - https://pragprog.com/book/khrust/programming-webassembly-wit...

This book steps through learning about web assembly, writing it by hand, and then implementing a server for webassembly. I had so many misconceptions about webassembly/wasm before reading this.

When anyone says they want to learn to code(tm), I tell them to do that book, front to back, then build a twitter clone with what they've learned. I expect you'd be job ready after doing that. It's how I did it. Nobody has taken my advice in earnest yet.
VERY interested in "Building Enterprise JavaScript Applications"

I noticed that it was released Sept 2018. That's not too old, but I'm curious if there's a more up-to-date version.

That's a funny joke. But really, I'm sure it's outdated.

There really shouldn't be any JS books in print...

You think so? I figured maybe 10-20% of it was out of date, but that it was still probably worth buying. Still looking for alternatives, but considering it.
Hello! Author here! The book introduces a lot of tools (~20) and these tools are bound to get out of date eventually. As a matter of fact, the Babel libraries moved from v6 to v7 during the writing process, and I've had to painstakingly rewrite most of the book to keep itself updated.

But the core value of the book is not in the tools themselves, but the concepts and principles of these tools, and how these tools work with each other. And these don't get outdated as easily!

I didn't find it too out of date. I used the latest versions of everything and the only thing I had to update myself was the React section for the frontend to use hooks. Packt books regularly go on sale for $5-$10 so you can also wait for one of those.
And even then, I'm guessing you didn't have to update it, right? The code (classes I'm guessing?) probably still worked.

In any case, thanks for the feedback!