Re:Everyone can write bad code
by maxxxxx on Thursday February 08, 2018 @01:27PM
(#16334317)
The premature optimization thing is often used as an excuse to write plainly stupid code without any thought. I think that's what #5 is about.
[ Parent
| on HN ]
Several times I've heard novice programmers cite the "premature optimization" saw as an argument against doing things that weren't optimization at all. Handling edge cases correctly, for example, or throwing exceptions instead of returning incorrect results, or handling two input formats instead of one, or tolerating trailing whitespace on input.
"Optimization" means "making code run faster without changing what it does". If you're changing the code's behavior in an observable way, that's not optimization.