Ask HN: What is the most beautiful piece of code you've ever read?
11–20 of 394 posts
Re: Ask HN: What is the most beautiful piece of code you've ever read?
#12For me, the answer is - The code that never existed. Not to sound cheeky but eliminating code, is a beautiful thing. Less code is easier to maintain, understand, and faster to run. So the less code you can achieve, the better overall the software will be.
Re: Ask HN: What is the most beautiful piece of code you've ever read?
#13As a student in 2001, Tim Sweeney's template recursive inheritance was next level for me: https://www.flipcode.com/archives/Vector_Math_Quaternions.sh... About 10 years later you would find this stuff everywhere in boost but for the time this was spectacularly elegant for C++
Re: Ask HN: What is the most beautiful piece of code you've ever read?
#14https://gist.github.com/zabirauf/29c89a084901cab8bc6b
Parsing binary data can be...nontrivial. The beauty is in the code that doesn't exist.
Re: Ask HN: What is the most beautiful piece of code you've ever read?
#1510 print "Hello World"; 20 goto 10; run
Re: Ask HN: What is the most beautiful piece of code you've ever read?
#16Re: Ask HN: What is the most beautiful piece of code you've ever read?
#17It's a bit of a tricky question because you can have a beautiful snippet entangled in a mess of a codebase. I think a much better question would be most beautifully structured codebase. Code, as a snippet, or line, is constantly struggling between poetic conciseness and verbose clarity... To which I will always pick clarity (for "the next guy"), hence not necessarily elegant.
That would be an interesting thread too! I think gorgeous snippets have a different kind of beauty that just generally well done projects.
To me, it's kind of like comparing the beauty of a gem to the beauty of a bridge.
Re: Ask HN: What is the most beautiful piece of code you've ever read?
#18Very elegant use of the fall-through behavior of the swtich statement.
Re: Ask HN: What is the most beautiful piece of code you've ever read?
#19Re: Ask HN: What is the most beautiful piece of code you've ever read?
#20John Carmack's Fast Inverse Square Root: https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overv... . The first time I really and truly felt that people approach problems differently from how I, by default, go about them.