Live data from Hacker News

Ask HN: What's the best source code you've read?

news.ycombinator.com

1–10 of 271 posts

Re: Ask HN: What's the best source code you've read?

#2
Maybe not revolutionary, but I think this article about static binary translation is a great introduction to the topic:

http://www.gtoal.com/sbt/

(see also the "Virtual Machines" book by Smith and Nair, ISBN-13 978-1558609105, if you are interested in this topic).

I can also recommend John Lions' "Commentary on the Sixth Edition Unix Operating System" - https://warsus.github.io/lions-/, Douglas Comer's Xinu (https://xinu.cs.purdue.edu) as well as Niklaus Wirth's "Compiler Construction" (https://people.inf.ethz.ch/wirth/CompilerConstruction/Compil...) and Project Oberon (http://www.projectoberon.com).

Re: Ask HN: What's the best source code you've read?

#4
Well, eye opening was the C++ source code I was able to work with at a previous company, they were an automotive HMI developer company. They had really strict and well planned code structure that just hit a chord with me.

Can't provide source though on that one, as it's a propietary engine. Recently I've enjoyed reading the source code to Sokol, lot's of really good decisions there and I love the minimal C -style structure:

https://github.com/floooh/sokol

Re: Ask HN: What's the best source code you've read?

#5
While at Grad school, before taking a course on Systems programming, I spent a few days reading through Redis source code. It felt almost like poetry.. I haven’t had that level of motivation or time to read open source code like that again.. so there may be better examples.. but this was my best…

Re: Ask HN: What's the best source code you've read?

#7

Well, eye opening was the C++ source code I was able to work with at a previous company, they were an automotive HMI developer company. They had really strict and well planned code structure that just hit a chord with me. Can't provide source though on that one, as it's a propietary engine. Recently I've enjoyed reading the source code to Sokol, lot's of really good decisions there and I love the minimal C -style str…

Nix source code is also a pleasure to read through. I was surprised that c++ could be so beautiful and well written.

Re: Ask HN: What's the best source code you've read?

#9
One of the most surprisingly clear code bases is LLVM. It’s an old complex beast, yet it’s organized beautifully.

I mean, it has a lot of essential complexity but little accidental complexity.

That’s usually what I strive for when coding. Complexity is sometimes unavoidable, that’s fine, that’s why it’s essential. However, avoidable complexity should be… well… avoided.

Re: Ask HN: What's the best source code you've read?

#10
Postgres code is very good, redis as well. Some of the core parts of Linux also totally worth learning from.

I also remember how Qt UI code and docs were a revelation after the nightmare of win32 and related frameworks.

Bellard's original Tinycc was very entertaining and took a while to digest.

Most old and well-maintained projects are worth learning from.

Apart from some local tips and tricks what is more important is understanding that there's nothing special about other people's code.

Post reply on HN