3 ms·
Personally, I use the rule of three. If it's copied three times, refactor it into some form of dependency. At that point, you should understand the use case, an
by falcolas 11y ago
Personally, I use the rule of three. If it's copied three times, refactor it into some form of dependency. At that point, you should understand the use case, and should be able to create a reasonably designed API.
- krishicks 11y agoWhen doing this, be wary of what a friend of mine calls "misfactoring", an example of which being where you take three very similar, very readable bits of code and convert them into a single, parameterized mess that isn't understandable at all.