News for hackers. Stuff that matters.
Re:Ask HN: What Is Readable Code? by smoldesu on Sunday September 25, 2022 @08:06PM (#32977830)
I used to have a friend who was obsessed with 'one-liners'. It's cute at first, chaining a couple methods together into one clean coke-line, but the problems don't ever crop up until someone else tries reading it...

So, my opinion is that 'readable code' organizes pragmatic sections together, and uses line comments and blank lines to annotate and separate. It's also perfectly fair to expand sections of your code if you're confident that your compiler will optimize it properly; I've seen people complain about C/C++ code doing this, but I think it does wonders for readability. Taking 20 seconds to make a readable version of your function could save hours of debugging time down the line, you never know.

There are no comments on this comment yet.