HACKER Q&A
📣 Foe

Books that teach you programming languages via systems projects?


Looking for a book/textbook that teaches you a programming language through systems (or vice versa). For example, a book that teaches modern C++ by showing you how to program a compiler; a book that teaches operating systems and the language of choice in the book is Rust; a book that teaches database internals through Golang; etc. Basically, looking for a fun project-based book that I can walk through and spend my free time working through.

Any recommendations?


  👤 mprovost Accepted Answer ✓
I'm publishing a book doing exactly this, rewriting one Unix utility per chapter from the BSD C version into Rust. The first two chapters for true/false and yes are published, with head, wc, cat, cut, rev, and uniq coming soon as I finish editing and typesetting each.

https://rftgu.rs/


👤 tompark
It's possible to work through Bob Nystrom's Crafting Interpreters[1] using any language you want. On GitHub just search for "crafting interpreters"[2] and add a filter for the programming language you're interested in, and you'll find at least a couple repos for the entire book. There are over a dozen complete repos in Rust. Since everyone breaks out each chapter in a separate folder, it's easy to follow along with the book, even though the book's first interpreter is written in Java and the second compiler was written in C. I did this, it's basically how I learned Rust.

[1] https://www.craftinginterpreters.com [2] https://github.com/search?q=crafting+interpreters


👤 RapperWhoMadeIt
I am obsessed with "The Linux Programming Interface" by Michael Kerrisk. I highly recommend this book if you want to level up your C programming skills and knowledge of Unix operating systems (specially portability and Linux). It might not exactly fit your description, but I still would recommend it. I feel like my C skills have gone from medium to pro, since reading most of the book. One really gets a good grasp of what syscalls exist, what they do and how to properly use them to produce secure and portable code. It is not written following a single project, but there are many different "applications" in the different chapters, for example, at the end you will be able to program a stand-alone back end TCP server with the examples from the book.

👤 adamgordonbell
The Ray Tracer Challenge[0] is super fun and language agnostic. It might be a good second project when learning a language. He also has a book about mazes that is great but ruby specific. Though you could adapt it to another language.

The thing I like about the books is the emphasis on having fun. My understanding is Jamis used these projects to overcome career burnout. They are also good for exploring the basics of a new language though.

I interviewed Jamis about this subject and burn out[1].

[0]: http://raytracerchallenge.com/

[1]: https://corecursive.com/025-burn-out-and-recreational-progra...


👤 westurner
From "Ask HN: What are some books where the reader learns by building projects?" https://news.ycombinator.com/item?id=26042447 :

> "Agile Web Development with Rails [6]" (2020) teaches TDD and agile in conjunction with a DRY, CoC, RAD web application framework: https://g.co/kgs/GNqnWV

And:

> "ugit – Learn Git Internals by Building Git in Python" https://www.leshenko.net/p/ugit/


👤 yarinr
Rust in Action teaches Rust through systems programming

https://www.manning.com/books/rust-in-action


👤 eru
See "Write Yourself a Scheme in 48 Hours" https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_... and "Write You A Haskell" http://dev.stephendiehl.com/fun/

👤 jodersky
Hands-on Scala Programming (https://www.handsonscala.com/) is a great way to learn Scala. It's down-to-earth, project-based and focuses on the practical side of the language.

👤 faraaz98
IntermezzOS: http://intermezzos.github.io/

Phillip Opperman's Blog OS: https://os.phil-opp.com/


👤 abecedarius
Norvig, https://github.com/norvig/paip-lisp (free online now).

👤 rkangel
"Designing Elixir Systems with OTP" is a great book.

It's not intending to teach you the basics of the language, it is instead teaching you how to architect real world programs, using a particular case study that they work through (a quiz game). It's basically about the 'functional core, OTP boundaries' model that is an excellent approach for building real systems.

If you don't know Elixir at all the Getting Started guide is good for teaching the language constructs: https://elixir-lang.org/getting-started/introduction.html


👤 cppwithprojects
For C++, we've built Learn C++ Through Projects [0], which is a project-based C++ course.

We currently offer only one project to build a transport network monitor. It starts with some low-level topics (we use WebSockets to handle tens of thousands of network events) but a lot of code is also higher-level (we use the network events to create a routing engine) - so it may not be exactly a "systems programming" resource!

[0] https://learncppthroughprojects.com


👤 e19293001
Books by Anthony J. Dos Reis

Those are so much underrated books that thought me how to become a software engineer. I hightly recommend especially these books.

Assembly Language and Computer Architecture Using C++ and Java

Compiler Construction Using Java, JavaCC, and Yacc

I promise! You'll obtain tons of skills from his books. I'm very debted to this man. I enjoyed a lot reading his books and made me who I am today.


👤 kaycebasques
I never worked through this, and it may be outdated now, but Let's build a browser engine! seems to fit the bill: https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.h...

👤 alfiedotwtf
You might enjoy Andy Tanenbaum's MINIX book, or (even though it's really old now), the MMURTL V1.0 book

👤 xupybd
Get programming with F# is not one big project but it's got fun little ones to play with.

👤 wishinghand
There's the Writing an Interpreter/Compiler in Go books: https://interpreterbook.com/ (Compiler book link is on that page too).


👤 easytiger
Computer Systems: A Programmer's Perspective

by Randal E. Bryant (Author), David R. O'Hallaron (Author)


👤 simonebrunozzi
Great thread so far.

Anything specific for Python, and recent enough to be based on the latest Python (3.9.5, or at least 3.x)?

I remember (but can't find it, sorry) a great "learn by example" web tutorial, but based on Python 2.x, and possibly at least 6-7 years old by now.



👤 neophyt3
my 2 cents... A single book wont teach everything, there will be missing holes, its better to have 2 monitors, open some small libraries in one monitor and go to first commit and start typing that and also understand it and gradually move to next commit... do it for 3-4 prjects and then u r set

👤 qualudeheart
Just ask openAI codex or github copilot.

It’ll all be natural language interfaces based on neural networks like that.

I wish things were otherwise but I can’t in good faith recommend someone learn “to code” or learn any programming language anymore.


👤 eurasiantiger
This seems like a terrible idea unless you specifically want to learn how to program specific kinds of things on specific languages.

That said, I can see how this could be useful to someone who is already well versed in programming and computer science, and has other types of project experience—they have a solid foundation to build and reflect on.