Ask HN: Books that teach you programming languages via systems projects?
204 points by Foe 3 years ago | 66 commentsAny recommendations?
- mprovost 3 years agoI'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.
- b3morales 3 years agoAdded to my to-check-out list! Thank you for providing such a robust sample to download (it looks like a whole chapter); that's a really nice touch.
- b3morales 3 years ago
- tompark 3 years agoIt'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
- KineticLensman 3 years agoConcur with this recommendation. Coincidentally, I started this project just recently, having really enjoyed completing Make a Lisp [0] a couple of years ago, and now needing something to do while I recover from a medical condition. I'm really impressed with Nystrom's writing style and Interpreter development process.
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
- kgarten 3 years agoThanks. Will also try it in Rust.
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?
- steveklabnik 3 years ago
- scott_s 3 years agoAlso discussed on HN recently (https://news.ycombinator.com/item?id=28445174) and when published (https://news.ycombinator.com/item?id=22788738).
- scott_s 3 years ago
- yutijke 3 years agoIt seems to be handcrafted. https://github.com/munificent/craftinginterpreters/tree/mast...
Custom dart code to convert and process markdown.
- steveklabnik 3 years ago
- KineticLensman 3 years ago
- RapperWhoMadeIt 3 years agoI 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.
- matheusmoreira 3 years ago> 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.
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.
- matheusmoreira 3 years ago
- adamgordonbell 3 years agoThe 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...
- thrower123 3 years agoThe Maze book is really good. Definitely recommend.
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...
- destring 3 years agoThanks for this. I'm seriously burntout due to using a very niche ERP framework that leaves no room for personal growth, this is exactly what I needed.
- thrower123 3 years ago
- westurner 3 years agoFrom "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 3 years agoRust in Action teaches Rust through systems programming
- paulgb 3 years ago+1 for Rust in Action, great book.
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.
- paulgb 3 years ago
- eru 3 years agoSee "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 3 years agoHands-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 3 years agoIntermezzOS: http://intermezzos.github.io/
Phillip Opperman's Blog OS: https://os.phil-opp.com/
- abecedarius 3 years agoNorvig, https://github.com/norvig/paip-lisp (free online now).
- rkangel 3 years ago"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 3 years agoFor 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!
- jaguar86 3 years agoGreat work. When do you plan on completing the final parts of your project - Optimization and Productization? Really looking forward to those.
- cppwithprojects 3 years agoThank you! We are going to release the Optimization section this week and the Productization one soon afterwards. In the meantime, we had to update a lot of the content around WebSockets based on user feedback - you'll receive an email soon!
- cppwithprojects 3 years ago
- bogomipz 3 years agoI really like this. Do you plan to add more projects as well?
- cppwithprojects 3 years agoWe do! We have been working on new content more slowly than we hoped, though... Our fist project received a lot of attention and we want to make sure we can support all existing developers first.
- cppwithprojects 3 years ago
- jaguar86 3 years ago
- e19293001 3 years agoBooks 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 3 years agoI 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 3 years agoYou might enjoy Andy Tanenbaum's MINIX book, or (even though it's really old now), the MMURTL V1.0 book
- blahdeblah123 3 years agoMMURTL - now there's a blast from the past!! I learned a lot from that book (by Richard Burgess IIRC) and playing around with the code was fun. Mostly 386 assembler and some C from what I remember. Yes, the Minix book is also good.
- alfiedotwtf 3 years agohehe yeah, it was one of the coolest books I had ever seen in a local public library!
- alfiedotwtf 3 years ago
- blahdeblah123 3 years ago
- xupybd 3 years agoGet programming with F# is not one big project but it's got fun little ones to play with.
- wishinghand 3 years agoThere's the Writing an Interpreter/Compiler in Go books: https://interpreterbook.com/ (Compiler book link is on that page too).
- fybs 3 years ago
- vymague 3 years agoI was going to post that link. There also several language-specific lists like https://github.com/rby90/project-based-tutorials-in-c .
- vymague 3 years ago
- easytiger 3 years agoComputer Systems: A Programmer's Perspective
by Randal E. Bryant (Author), David R. O'Hallaron (Author)
- mathieubordere 3 years agoI can highly recommend this, on the following site you can find the labs accompanying the book http://csapp.cs.cmu.edu/3e/labs.html
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.
- markus_zhang 3 years agoSecond this, don't buy global edition. The authors explicitly mentioned that they are NOT going to release an errata for it. Probably because it would be a book of itself...
- vymague 3 years agoI always find the whole thing ridiculous. They literally just needed to copy-paste the original book. In their effort to discourage people from buying the international edition, they scrambled the exercises and their numbers. And introduced errors that way.
- vymague 3 years ago
- hackermailman 3 years agoSearching YouTube for 15-213 there is lectures by the authors for that book too.
- markus_zhang 3 years ago
- mathieubordere 3 years ago
- simonebrunozzi 3 years agoGreat 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.
- cameron_b 3 years agoLearn Python the Hard Way, [0]
It isn't the most grand systems approach, but does build a text dungeon crawler and then makes it a web application.
- ctippett 3 years agoI can highly recommend Test-Driven Development with Python[0]. The book has you build and deploy a web application, with emphasis on writing tests at each stage of development. The author has a great sense of humour and the whole book is a fun read-through.
- markus_zhang 3 years agoThere is a book called "Black Hat Python". The second edition targets Python 3 and because of the nature of the topic is mostly lower level programming.
- cameron_b 3 years ago
- croh 3 years ago
- neophyt3 3 years agomy 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
- shomyo 3 years agoUnderstanding Unix/Linux Programming by Bruce Molay. Not cpp though
- qualudeheart 3 years agoJust 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.
- methusala8 3 years agoAre you super pessimistic about the future of this profession?
- qualudeheart 3 years agoYeah. It’ll probably morph into something between a trade and a secretary tier position, where you receive orders from a business analyst, expand on then and feed them into a language model which does the actual programming. Right after that the business analyst does that too and finally their job is also automated.
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.
- gverrilla 3 years agoI'm a business guy, but I have also coded a few mvp's including a deep and complicated algorithm in Python. In my social and professional surrounding I'm considered a tech expert, but I'm very well aware I'm not even near that, and consider myself an amateur - particularly here on HN. What you are describing seems like a dream to me, a good one, but it's obvious you think otherwise. Mind you telling me why? In my experience I have never worked with passionate programmers, they all see it as a job to get done and if you want intelligence and depth that's on you. I don't have such a vast experience hiring or working with professional programmers, but I have some and it has been consistent in what I'm telling you. Most of them were assembly-line style programmers, specializing in one or two things (meaning they learn how to replicate the work needed). And I would have a really hard time if I needed elite programmers for these tasks, and also no money to pay for it. The way I see it, making all the programming easy should be a net benefit for (almost) everybody, particularly in a stage when it gets so complicated to do simple stuff like making a website. To be honest, I've been around a lot and I have never really met an elite programmer irl. I have met a lot of dedicated and smart people, yes, and also good hackers, but not really passionate experts. I also live in Brazil, if it matters.
- qualudeheart 3 years agoAdded context: this is a very pessimistic projection, and when it comes true will depend how long the trend in neural network scaling continues.
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.
- gverrilla 3 years ago
- qualudeheart 3 years ago
- methusala8 3 years ago
- eurasiantiger 3 years agoThis 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.
- eru 3 years ago> This seems like a terrible idea unless you specifically want to learn how to program specific kinds of things on specific languages.
Many people learn from specifics and generalise later.
Do you think there's anything wrong with that?
- eurasiantiger 3 years agoI think there is a high chance that once they learn to use a middle-handed hammer, too many things look like middle-handed nails.
- convolvatron 3 years agois there another option? I personally would probably never have taken up programming at all if I had to sit through a year of high level concepts before I tried to apply a compiler to some source code.
- convolvatron 3 years ago
- eurasiantiger 3 years ago
- HeJAnQuer 3 years agowhat would you recommend as a supplement to someone that is currently studying computer science to better learn programming?
- eurasiantiger 3 years agoActual project work solving actual clients’ problems in an area that matches your probable future employment. Consider doing something for free (without deadlines) just for experience.
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.
- sayonaraman 3 years agoFreelancing as a student is underrated
- sayonaraman 3 years ago
- eurasiantiger 3 years ago
- eru 3 years ago