Hacker News new | ask | show | jobs
by codewench 481 days ago
Conversely, it's far better to have a slightly more verbose section of code that is immediately readable than a super slick one-liner that like two people can parse.

Maintainability is, in my opinion, just as important as other considerations when writing code. And often the more verbose approach is composed of simpler steps, meaning bugs can be easier to spot during code reviews

1 comments

Agreed. For readability, ignoring DRY, my hierarchy of preference is:

1. One reasonable line of code

2. Several lines of plain code

3. A function call, moving the implementation elsewhere

4. A gnarly one-liner

(The tough part about this is drawing the line between 1 & 4.)