4 ms·
I like DRY. Do Repeat Yourself. You can always refactor later, once the requirement/change is fully implemented.
by fuzzy2 4y ago
I like DRY. Do Repeat Yourself. You can always refactor later, once the requirement/change is fully implemented.
- icedchai 4y agoRepeating yourself 3 or 4 times is okay. After that, it is probably worth cleaning up.
- fuzzy2 4y agoHm, I don’t think it’s about the number of repetitions. Even two can be too much if it’s the same logic, not just coincidentally. The same logic may not always be a code clone either. Maybe you need to generalize the code to remove the repetition. The reverse is also true: If it’s not the same logic, it should not be deduplicated. Even if it is a code clone now. It will probably lead to unintended bugs down the line when that code changes.