2 ms·
They're just two sides of the same coin. YAGNI is the starting point. Be as minimal as possible. Code is just like inventory in a supply chain. Do things as
by stcredzero 16y ago
They're just two sides of the same coin. YAGNI is the starting point. Be as minimal as possible. Code is just like inventory in a supply chain. Do things as cheaply as possible for as long as you can get away with it.
I think you're misinterpreting Type 2. You don't bring out Type 2 to prevent future problems. You bring it out to solve problems.
I have a rule: don't apply a pattern or other advanced technique until doing so will eliminate or reduce code in more than 3 places. If the same code starts popping up in more than 3 places, it may show up in a whole lot more, and it's going to start being a pain to find all of the occurrences. On the other hand, just finding 2 or 3 and correcting them is not really that hard, so leaving things until n=4 is not too bad.
Going back to the article, never apply a pattern in a language until doing so yields fewer lines of code than the original code. If your language requires N > 10 for this to be true for most patterns, then switch languages! (Someone should turn this into a metric!)