Live data from Hacker News

Ask HN: How to learn proper systems programming?

news.ycombinator.com

71–80 of 97 posts

Re: Ask HN: How to learn proper systems programming?

#71

Years ago I modified the Postgresql source code (8.xx). It's something I was terrified of doing. But once I got in there and started poking around, I realized it was just ordinary plain-vanilla C code. Not C++. Just C code. With my local copy, I started to hack pg_dump to do something special that we wanted at the time. Even after 30 years of coding, I'm not that especially good of a programmer. But I ended up gettin…

My perspective:

Anything that's been done by a lot of people, has been done well-enough by some stupid asshole.

I am a stupid asshole.

Therefore, I can probably figure out how to do [thing] well-enough, if it's been done by a lot of people.

It's worked out OK so far.

Re: Ask HN: How to learn proper systems programming?

#72

Years ago I modified the Postgresql source code (8.xx). It's something I was terrified of doing. But once I got in there and started poking around, I realized it was just ordinary plain-vanilla C code. Not C++. Just C code. With my local copy, I started to hack pg_dump to do something special that we wanted at the time. Even after 30 years of coding, I'm not that especially good of a programmer. But I ended up gettin…

My perspective: Anything that's been done by a lot of people, has been done well-enough by some stupid asshole. I am a stupid asshole. Therefore, I can probably figure out how to do [thing] well-enough, if it's been done by a lot of people. It's worked out OK so far.

I have printed out a foreword of an old calculus book, and taped to my wardrobe door. It's a long-ish rant, but it ends with this:

    What a fool can do, another can.

Re: Ask HN: How to learn proper systems programming?

#74

Earlier quoted context omitted.

My perspective: Anything that's been done by a lot of people, has been done well-enough by some stupid asshole. I am a stupid asshole. Therefore, I can probably figure out how to do [thing] well-enough, if it's been done by a lot of people. It's worked out OK so far.

I have printed out a foreword of an old calculus book, and taped to my wardrobe door. It's a long-ish rant, but it ends with this: What a fool can do, another can.

Pretty sure that's Calculus Made Easy, a book which I, as a fool, certainly ought to recognize, and yeah, that's the gist of my approach to "scary" topics. "Have lots and lots of people done it? Then I'll likely be fine, because some of those people were assuredly at least as dumb as I am."

Re: Ask HN: How to learn proper systems programming?

#76

Another interesting rabbit hole to explore is the compiler. Back in the day I wrote a toy compiler for a college course and used this text book: "Compilers: Principles, Techniques, and Tools". a.ka. "The Dragon book", but I would look at some of the other books here like "Modern Operating Systems" before this.

I feel like dragon book focuses too much on formal math

this is great:

https://news.ycombinator.com/item?id=25386756

Re: Ask HN: How to learn proper systems programming?

#77

Years ago I modified the Postgresql source code (8.xx). It's something I was terrified of doing. But once I got in there and started poking around, I realized it was just ordinary plain-vanilla C code. Not C++. Just C code. With my local copy, I started to hack pg_dump to do something special that we wanted at the time. Even after 30 years of coding, I'm not that especially good of a programmer. But I ended up gettin…

A small counterpoint: I once worked in a code base where small changes would regularly ripple out and cause bugs far far away. You had to traverse a 30-50 source file chain of logic to find what was happening. This was “normal.”

I’m not saying you have to be afraid, just that you sometimes have to tread a bit slower and do a lot of testing as you go until you learn the internals of whatever system you are working on

(Aside: this is what coupling does — you should fear coupling!)

Re: Ask HN: How to learn proper systems programming?

#78

Another interesting rabbit hole to explore is the compiler. Back in the day I wrote a toy compiler for a college course and used this text book: "Compilers: Principles, Techniques, and Tools". a.ka. "The Dragon book", but I would look at some of the other books here like "Modern Operating Systems" before this.

The Dragon Book is literally a bad compiler book and you shouldn't read it. I don't know why people recommend it (not saying you did.) It explains things poorly and gets far too into the weeds on things that don't matter.

I recommend "Parsing Techniques: A Practical Guide" and Muchnick's compilers book - though there's probably something better by now.

Re: Ask HN: How to learn proper systems programming?

#79
These books are good, especially the last one by Stevens.

Three things helped me a lot to learn more about systems programming:

(1) the reading of existing systems code, especially (i) from a book called Dr Dobb's C-Tools, which includes a C compiler, assembler and linker as well as many command line tools and (ii) the Minix source code. It was the code in this book rather than K&R or Stevens that let me "get" systems programming because I needed to see the bigger picture, and many books only show small code snippets.

(2) the study of other people code; if yo; au have access to a C guru, it's really helpful to just peek over their shoulders for a couple of hours as they implement a new module and then debug it (thanks, Gero and Rolf!) - thankfully, there is a new trend of people recording coding sessions and putting them on YouTube, so more people out there can benefit from experienced hackers e.g. https://www.youtube.com/watch?v=1-7VQwWo2Tg . And, of course,

(3) implementing a non-trivial low-level component. For me, this was having to implement the buffer management of a relational database management system in C from scratch as an exercise in my undergraduate degree (we were given 6 weeks, but not full-time, as lectures were going on at the same time). This course, Systems Programming II, was as beneficial as it was gruesome, but I'm grateful to excellent line-by-line pencilled feedback of one tutor that read the complete code and commented every missing return value check etc.

Re: Ask HN: How to learn proper systems programming?

#80
I would also add Computer Systems: A Programmer's Perspective, 3rd Edition by Bryant and O'Hallaron and C Programming: A Modern Approach, 2nd Edition by K.N. King, to the list. I'm learning systems programming and theory at the moment as well. Both are venerable seminal works on their subjects for the self guided learner.

If anyone here wants a quality PDF of either, I can make that happen, I digitize textbooks as a hobby. I bought both books new from Amazon and were well worth the price new.

Post reply on HN