It’s not the best, far from it, but it was fascinating to me so I will share. I used to work for a large newspaper. Engineering wasn’t the focus of the business, it was only a means to an end, it was just something they needed to have a competitive website. As a result, the churn rate was very high. But more interesting there was also a very high return rate. Engineers would come and go and return and leave again all…
The book "A Deepness in the Sky" features people living on an ship whose operating system is thousands of years old. One of the main characters is considered a software archaeologist of sorts - he's an engineer, but in a sense also a historical researcher. I can't emphasize enough that this notion is only a side point in the story and not a main aspect of the plot, sadly, so I wouldn't go reading it in hopes of heari…
Ask HN: What's the best source code you've read?
81–90 of 271 posts
Re: Ask HN: What's the best source code you've read?
#82My own - hell is other people’s code.
The 7th circle of hell is my own from 3 months ago. I can't even blame someone else for the tragedy.
C++ from 14 years ago:
https://github.com/vlofgren/tunguska/blob/master/tunguska_3c...
A career of Java development later, and the code I wrote yesterday looks like this:
https://git.marginalia.nu/marginalia/marginalia.nu/src/commi...
My old code was so tidy. Can't believe I wrote code like that. Although back then I think I mostly used vim. Not having any sort of IDE tooling does sort of tend to force you to be a lot clearer about what you do.
Re: Ask HN: What's the best source code you've read?
#83Re: Ask HN: What's the best source code you've read?
#84Poul-Henning Kamp was on a FreeBSD podcast (~15 years ago) and did an approachable walkthrough of the performance considerations he made when he created varnish. It stoked some serious curiosity in me, i was working on a system that heavily cached IO in userspace (and paid LOTS of money to do so - we're talking 100s of nodes) and here he was saying things like (i'm paraphrasing here) it's pretty dumb to cache your da…
[0]: http://bsdtalk.blogspot.com/2006/10/bsdtalk072-interview-wit...
Re: Ask HN: What's the best source code you've read?
#85Postgres 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…
Re: Ask HN: What's the best source code you've read?
#86every time I am not fully sure what some function from golang std library does, I just click away to its source code and it’s quite clear
Re: Ask HN: What's the best source code you've read?
#87The early Go standard library (before it was hyper-optimized.)
Re: Ask HN: What's the best source code you've read?
#88Nobody has mentioned Knuth’s corpus of work in Pascal-Web for the TeX ecosystem. This is code written for an era where there wasn’t an ecosystem of libraries for common tasks and even things like being able to access a file in random access order couldn’t be counted on. Even 7-bit ASCII couldn’t be counted on as a given (EBCDIC-based IBM mainframes were a significant element of the computing landscape still). Against…
Re: Ask HN: What's the best source code you've read?
#89Earlier quoted context omitted.
> a lot of essential complexity but little accidental complexity Nice one. I'll copy that.
You might be interested in reading the paper, No Silver Bullet, in which Fred Brooks coined these terms: http://worrydream.com/refs/Brooks-NoSilverBullet.pdf
Re: Ask HN: What's the best source code you've read?
#90Bitcoin
Bitcoin the app is often mixing several layers of abstractions and several usage patterns together.
Is it for actually keeping track of money? Is it for APIs? is it for end users, or for servers? Is it CLI or a GUI app?
And it’s in C++, which is almost never readable.
And of course they have their weird names for everything (all the ScriptSigs etc), and the OP script which is at the same time too complex and too simple.
It’s surprisingly robust and it survived a lot, sure; I don’t take it down on that level; but the code even today got baggage of all the weird decisions Satoshi did when he made it.
It’s really not “good code” IMO.
Although they have improved it a lot in last few years, I will give them that. It was worse…