Live data from Hacker News

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

news.ycombinator.com

71–80 of 271 posts

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

#71
I haven’t read all of it, but the Principia source code has a comprehensive units system and makes effective use of Unicode: https://github.com/mockingbirdnest/Principia/

https://github.com/mockingbirdnest/Principia/blob/master/ast... is a decent example of both:

    // We compute the mean rate (slope) of the mean anomaly M(t), the mean
    // argument of latitude u(t), and the longitude of the ascending node Ω(t).
    …
    Product> ʃ_Mt_dt;
    Product> ʃ_ut_dt;
    Product> ʃ_Ωt_dt;
    …
    ʃ_Mt_dt += (Mt + previous_Mt) / 2 * dt;
    ʃ_ut_dt += (ut + previous_ut) / 2 * dt;
    ʃ_Ωt_dt += (Ωt + previous_Ωt) / 2 * dt;
    …
    anomalistic_period_ = 2 * π * Radian * Δt³ / (12 * ʃ_Mt_dt);
    nodal_period_ = 2 * π * Radian * Δt³ / (12 * ʃ_ut_dt);
    nodal_precession_ = 12 * ʃ_Ωt_dt / Δt³;
The advantages are concise notation plus compile–time guarantees that the units work out. I don’t care much for C# in general (or C++ for that matter), but I like the results here.

Sounding out the Greek names occasionally used as release names is always fun too.

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

#72

Poul-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…

[deleted]

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

#73
Not exactly source code, but the https://frinklang.org/frinkdata/units.txt is the most fascinating configuration file I've ever read. It is also the only one that I occasionally re-read just to enjoy the commentary on the standards organizations that are responsible for some of the complexity.

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

#74

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…

DRMaciver wrote a novella about it. Programmer at large, it's called. Largely about cultural variation in gender and sex norms.

https://www.drmaciver.com/category/programmer-at-large/ (down)

https://archiveofourown.org/works/9233966/chapters/20941043

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

#77

My own - hell is other people’s code.

Haha, mine sure as hell isn't.

Whenever I try to polish some piece of code into some immaculate crystal it only takes a short while before I go and make some change to it and then it looks like crap again.

I try to keep it at a level where it doesn't get too out of hand it can't be refactored in an afternoon, while at the same time refraining from masturbatory polish.

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

#78

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…

> I can't emphasize enough that this notion is only a side point in the story and not a main aspect of the plot

Is it sprinkled throughout the story, or a mostly uninterrupted block of text? As in: is there an easily findable chunk of the book one could read for that idea alone? If so and you could provide a few keywords or a direct quote, I’d be interested in grabbing the book to read that.

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

#79
post #26

Earlier quoted context omitted.

> a lot of essential complexity but little accidental complexity Nice one. I'll copy that.

That's from "The mythical man-month". Old, and some parts are obsolete, but still worth a read as it does have a bunch of good insights.

I have not read it in a while but it would be interesting to debate what essays are no longer relevant. I'll be grabbing it off the shelf next to my original copy of the Byte issue on C mentioned yesterday and having a look for expired relevancy.
Post reply on HN