I thought exactly the same thing.
A wise man once said: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%"
But first, we have to know which 3% and chances are really, really, really good that it's NOT the little chunk you're hung up on trying to find "the best" solution to/for.
Paralysis by analysis is a real thing and slows everything down while the "loop-ee" doesn't even realize they're executing an O(∞) search algorithm.
There are certainly cases where I can say "this is a critical path that I should spend some time optimizing more", or "this part is going to have to cope with a lot of different situations and I should think about it in advance", but in most cases "hey this works" prevails.
Sometimes a day, a week or a few months later I see "oh, didn't expect this to happen, now I guess it needs some refactoring", but that's a lot better than having delayed everything else I worked on by trying to predict the future and accomplishing nothing.
We’re a place for programmers to stay up-to-date, learn new skills, and share ideas.
We’ll never post without your permission.