Ask HN: 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?
67 comments
[ 2.2 ms ] story [ 128 ms ] thread[1] https://www.craftinginterpreters.com [2] https://github.com/search?q=crafting+interpreters
My long term goal - which should keep me going for absolutely ages - is to use something like Nystrom's byte-code virtual machine as a basis for having another go at MAL. I completed MAL using C#, and am currently using Visual Studio / C# to complete Nystrom's stuff (rather than the Java / C combo that he uses). But I'm just about to restart Nystrom using a different language (again, perhaps Rust) to give myself more of a challenge.
[0] https://github.com/kanaka/mal/blob/master/process/guide.md
The web version of the book looks super nice. Anybody knows what Bob Nystrom used to build it? https://www.craftinginterpreters.com/introduction.html
handcrafted?
Custom dart code to convert and process markdown.
Phillip Opperman's Blog OS: https://os.phil-opp.com/
https://www.manning.com/books/rust-in-action
I'll add Distributed Services with Go as well https://pragprog.com/titles/tjgo/distributed-services-with-g...
It's pretty dense, mostly a code listing with some commentary between, so it takes some work to get through it, but I learned a ton.
Yes! The book really exposes all that hidden fun stuff that the system libraries abstract away from us. When I was a beginner I hated not understanding how they worked.
On Linux it's also theoretically possible to make system calls from any language. The binary interface is stable and really simple. Wish more languages had compiler support for this calling convention.
by Randal E. Bryant (Author), David R. O'Hallaron (Author)
remark: DON'T buy the Global Edition of the book, it contains different exercises than the original book and is riddled with errors, it's basically unreadable/unusable.
https://rftgu.rs/
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
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.
Client problems are typically very different from exercises in compiler or rendering architecture, or whatever, unless you happen to be striving for those exact niches, which just might be a pipe dream unless you’re spectacularly talented in abstract problem solving in low-level languages on multiple hardware platforms and capable of furthering those technical niches in some way that someone benefits from enough to keep employing you.
Many people learn from specifics and generalise later.
Do you think there's anything wrong with that?
> "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/
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...
In my previous work place, it happened that they were using Ofbiz as a framework. If they were using it solely for marketing sites and co, there would've been no problem but they were building complex APIs on top of Ofbiz.
All developers fought against it. Functionalities you could easily implement on Java (or Spring boot), required knowledge of the inner workings of Ofbiz. Not to talk of the bloat that comes with it all :(
One thing that I've found helpful often when learning a new language is taking some code written in a language I know already and porting it over into the new language. That's more fun with a project that actually does something interesting, and if you've got the original-language version running, you can compare output.
Peter Shirley's Ray Tracing in One Weekend book (and sequels) are also fun little projects
https://raytracing.github.io/books/RayTracingInOneWeekend.ht...
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.
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.
I expect this to destroy the “gig economy” of freelancers too, but only after existing programmers are forced out of normal employment and into “freelancing” with drastically reduced negotation power and workplace protections.
All the technical depth and fun is going to be removed unless you’re one of the very few most elite human programmers.
It breaks my heart seeing this happen but I can’t do anything about it. My advice to everyone is to grift their way into a startup, get as much equity as you can, sell it and retire early. With UBI coming in 10 or 20 years it shouldn’t be too hard.
Most leading ML researchers expect it to continue for a few more orders of magnitude of model size, which I think is enough for my prediction to come true.
The computer is a blank slate. Innocent. When it starts, there is nothing stored in its vast arrays of memory. No data, no code, nothing.
Bit by bit programmers carved meaning into that empty universe. This number is now a character. An array of these numbers is now text. An ordered list of these texts is now a program. Complexity increasing. We could do more and more with less and less. That new virtual world was revealing itself to us.
We were the gods of this virtual world.
With mere words we could conjure up incredible architectures out of nothing. We gave meaning to ordinary numbers. We invented structures. We developed systems. We erected infrastructure. Even language itself came from us. Limited only by our minds. The computer's capabilities shaped by our own understanding. Anything we thought possible, happened. Only the courage to try was necessary.
And now the computer is becoming so advanced and complex that our minds can no longer fully understand it. We can no longer fully control it. One day we will no longer be the gods we once were. The computer will understand things and reprogram itself.
A truly poignant end for us. Reduced to reliving our past glories in the comfort of old hardware and software.
> I also live in Brazil, if it matters.
It matters. I'm also brazilian and most other programmers I've met are exactly as you described. I actually quit professional programming because of that.
Yeah, computer technology is exactly like this today. What's it about? Consumerism. Engagement. Advertising. Surveillance. Corporate bottom lines. Government control.
It's such an incredible waste. The potential of computers used to be limitless. They empowered people. They once threatened monopolies, governments. To see them reduced to the state of appliances serving the very same elites they were supposed to free us from is just sad.
> Science and computers should be accessible to everybody, not only DaVinci's and elite programmers, and that's the way it will go.
That's okay. I just wish things were different.
Science fiction predicted the creation of AI. They were human-like. They were our friends. We could trust them. The dystopian cyberpunk hell we're heading towards has AI as a tool of corporations and the state, used to control people, exploit them. It has masters but they're not us. The AI snitches on us, reports our wrongthink.
> I hope you can find joy in life elsewhere in your mind/activity.
Thanks. I hope so too. I've found meaning in other activities but nothing matches the godlike feeling I used to get from programming.
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.
It isn't the most grand systems approach, but does build a text dungeon crawler and then makes it a web application.
[0] https://learnpythonthehardway.org/python3/
[0] https://www.obeythetestinggoat.com/
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