Live data from Hacker News

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

news.ycombinator.com

51–60 of 271 posts

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

#51

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…

The "software archeologist" idea has lived rent free in my head ever since I read the novel nearly twenty years ago. It's an absolutely fascinating premise, one I can most definitely see being viable to grow into a fully-fledged novel. I would definitely read that.

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

#52
post #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.

[deleted]

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

#53
post #16

Angular code is pretty complex but well organized. I still have yet to understand most of it.

It's not too bad, you just need to know TypeScript.. And not like "I know TypeScript." on a resume, I mean "I know TypeScript™."

For Angular, I think the “problem” lies in the level of abstraction. AngularJS was a “Spring / Java” answer to web applications with Angular following the paradigm but introducing reactivity to the system. Not “wrong” per-se, the quality of code is great and so I could recommend it at a tactical level of “good code” but at the strategic it feels off.

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

#55
post #41
post #37

The early Go standard library (before it was hyper-optimized.)

That's a fascinating observation. Do you think code inherently gets "worse" as it becomes more "optimised"?

Yes, as it becomes more complicated, catching more edge cases, it becomes less readable.

On the other hand, as the compiler improved, some parts of it became more readable (e.g not manually unrolling loops, avoiding manual inlining, introducing bit-manipulation functions into the library instead of repeating them everywhere).

Unfortunately, it's unavoidable — faster code is usually longer and more complicated.

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

#56
Nobody 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 all that, Knuth wrote code that could be ported to other systems (I first used TeX on an IBM mainframe running VM/CMS, then later on a VAX minicomputer running VMS, then on a PC with DOS, PC with OS/2, PC with Windows and now a Mac with OS X/MacOS. His presentation of code and internal documentation intermingled is something which I could see still being useful now, although sadly, literate programming seems all but dead now. I still go back to Knuth’s code to understand how to solve some problems on occasion even though it’s about 30 years since I last wrote a line of Pascal.

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

#57
post #46

My 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.

At 15+ years of coding, I feel the greatest issue jumping across projects I’ve done (of a recent vintage) is getting into the paradigm.

I have a differing framework to an SPA, to an API, and to personal utility scripts. Amplified by adding in co-workers and contributors.

The Golden Question becomes how to communicate philosophy to a broad and diverse audience, be it co-workers or open-source.

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

#58

My own - hell is other people’s code.

I have the exact same sentiment. My code looks like a poem, others looks like chicken scratch.

As my name implies - I’m half-serious in my sentiment. I’ve found many-to-most projects I’ve come across have personally-inconsistent conventions at a function level not to mention strategic architecture.

There is good code from other - but I feel many lack discipline in their initial approach and long term maintenance. In things as banal as variables. Not as a nit-pick but as a way of life.

It seems… concerning.

Post reply on HN