4 ms·
It's a dogma pendulum like "gotos are evil," "YAGNI," object-oriented design (is good/bad), etc. A pattern or anti-pattern gets identified and lessons drawn fr
by mike_hock 3y ago
It's a dogma pendulum like "gotos are evil," "YAGNI," object-oriented design (is good/bad), etc.
A pattern or anti-pattern gets identified and lessons drawn from it. Then people take the lesson as dogma and drive it to absurd extremes. Naturally this doesn't have the desired effect, and then the baby gets thrown out with the bathwater, people do the exact opposite and take that to absurd extremes.
Caching potentially expensive (relatively speaking) operations isn't "premature optimization," it's a design principle. It's much harder to retrofit something like this into a project after the fact than having and using it from the start.
"Premature optimization" is applying complicated micro-optimizations early on that won't survive any moderate code change.