5
Always thought 'tidy code' meant short code. Turns out I had it backwards.
I was reading through some old forum posts from 2018 on Stack Overflow and found a comment from a guy with 50k rep saying the single best metric for clean code is how fast a new person can understand it. Not lines of code, not clever tricks, not how many one-liners you cram in. For years I thought the goal was to make my Python scripts as short as possible. I'd spend hours turning a 20 line function into 5 lines using list comprehensions and walrus operators. Then I had to fix something I wrote 6 months ago and had no idea what it did. The stat that hit me was something like 80% of development time is spent reading existing code, not writing new stuff. That changed how I think about everything. Has anyone else found a metric they thought was gospel but later realized was completely wrong?
2 comments
Log in to join the discussion
Log In2 Comments
smith.jordan28d agoMost Upvoted
Same thing happened to me with a project I could barely read after just three months. The "compact equals clean" trap is REAL and it took a frustrating debugging session to finally break free. Now I focus on writing code that reads like plain instructions, not like a puzzle.
8
alice24228d ago
Honestly, I used to be one of those people who thought shorter code was always better. I would cram everything into one-liners and feel proud of it. But after spending three hours trying to untangle one of my own functions from six months ago, I totally get what you mean. It's humbling when you realize you were the one who made the mess in the first place. Now I actually try to write stuff out like I'm explaining it to someone who's never seen the code before.
4