3 ms·
I find the term DRY to be pretty vague. Let’s say you have a business rule that you can never have more than 5 widgets. You can make this assumption in multipl
by blowski 2y ago
I find the term DRY to be pretty vague.
Let’s say you have a business rule that you can never have more than 5 widgets. You can make this assumption in multiple places, even with totally different code, and that’s damaging DRY when the rule changes to allowing 6. On the other hand, having a bit of duplicated HTML can help, as they may only be the same by accident.
- mytailorisrich 2y agoIn thise case, '5 widgets max' would be a parameter that should be defined as a global constant instead of having a hard-coded 5s all over the place or, worse, pieces of code copy-pasted 5 times... That's a standard good coding practice.