19
Found out my 'clean code' habit was actually making my projects 2x harder to read
Last week I was refactoring a small script I wrote in January, and I kept splitting everything into tiny 3-line functions because that's what every tutorial says. Then I traced through it and realized I spent 20 minutes just jumping between function definitions for something a simple loop would've done. I looked up how long I actually spent on it versus what I would've done without splitting, and it was like 40 minutes vs 15. So I stopped being so rigid about the 'one function = one job' rule for short stuff. Has anyone else found that following best practices too strictly backfired for small beginner projects? What rule did you have to break on purpose?
1 comments
Log in to join the discussion
Log In1 Comment
lunaf6720d ago
Ha, honestly I'm the opposite. Those tiny functions saved me when I came back to a messy script three months later and could read each piece like a sentence instead of decoding a wall of logic. I've had way more "what does this loop even do" moments with the compact version. Maybe it's a style thing, but I'd rather jump between a few short names than untangle one dense block, especially when the project grows past a screen or two. Your 15 minute win might bite you harder when the file hits 500 lines.
7