Live data from Hacker News

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

news.ycombinator.com

31–40 of 271 posts

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

#31

Shodan. I used its codebase to learn python and recommend it everyone else.

Got a link? I'm not familiar with Shodan and I've done some searching but not found anything immediately obvious

https://github.com/achillean/shodan-python

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

#32
Of course the one I wrote few months ago! When I re-read it today I realize how good I was at foreseeing all the problems that would eventually arise. The code has descriptive comments that explain not just what the code is doing but what it is supposed to do. I was very impressed with not just 100% line coverage but also complete branch coverage by rock solid unit tests. Sorry can't share the link because code is proprietary.

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

#33
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 time.

As a result, the code base was a path work of various engineers with various skill level, different directions by different heads of engineering, repurposed old projects, legacy code and last minute additions by urgent request from the editors, among others.

The part I was most familiar with was what I can only describe as a sort of next.js but unlike it, it wasn’t planned or designed but rather it sort of grew organically over the years.

The fascinating thing to me was precisely this phenomenon. Some projects have a clear design and purpose and are built so from the start. Sort of like a building or a mechanical clock.

Others just evolve over time, they change, mutate, evolve, incorporate other bits. More like a biological organism or perhaps nature taking back a derelict settlement.

At first as you can imagine it was difficult to wrap my head around it. But in time, I started to see the beauty in it. It had historical bits. There was code written in 2010 that ran in 2020. Others you could tell little habits of the writer. Not everything gets stamped out by the linter. There was this guy who wrote “class ClassName extends React[“Component”]” - I have no idea why but I would run into code written by him and immediately recognise, ah yes, that’s that guy.

It’s certainly not an example of a good code base, but to me was interesting being able to see the code as a living organism with a history and fingerprints of it’s creators rather than a well designed machine.

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

#35

I remember liking the java sdk java source. Great small focused functions and nice use of newlines. You could tell the developers were forged in an era without syntax highlighting and large horizontal screens. Extremely scannable.

The Java standard library will forever be my baseline for “good.” Perhaps the C# beats it, but then the overall ecosystem of third-party libraries is such that it isn’t worth the slight improvements in design.

Node, by comparison, is a ghetto.

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

#36

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…

Sounds like the codebase really was a living thing in a sense

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

#39

Contrarian answer: Conway's Game of Life in Dyalog APL https://www.youtube.com/watch?v=a9xAKttWgP4 It feels like the logical end state of "clever" code, for better or for worse. Or, alternatively, what happens when a standard library is gigantic but each keyword is 1-2 characters.

my favorite of his videos is the sudoku solver: https://www.youtube.com/watch?v=DmT80OseAGs
Post reply on HN