Hacker News new | ask | show | jobs
by trevyn 3756 days ago
>So, why do we do it?

I do it because it reduces physical code size and helps me "chunk" code in my brain. Since I wrote it, I know what I intended it to do and how it does it, possibly with the aid of a small comment.

This helps me have a more compact complete representation of the surrounding code, both in my editor and in my brain.

Is it bad for verifying correctness and allowing others to understand the code? Sure. But there is absolutely a well-considered reason why I do it, and it's not to show off.

2 comments

Any code whose readability depends on information stored only in your brain is bad code, sorry. Perhaps there are times when bad code is excusable, but there is no argument that such code is high-quality. The best code expresses an idea in the simplest way possible, which is not synonymous with the fewest number of lines possible.
> I do it because it reduces physical code size

And aren't the number of bugs loosely related to the number of lines of code? A darling has fewer chances of a typo bug.