4 ms·
I had a general guidelines in my previous company which I follow to this day to great results. If a piece of code is duplicated thrice, it's ok. If a piece cod
by NikhilVerma 4y ago
I had a general guidelines in my previous company which I follow to this day to great results.
If a piece of code is duplicated thrice, it's ok. If a piece code is duplicated four times, then you must extract it.
- usrusr 4y agoSolve every problem once. Two times repeated can be much worse than ten times repeated if one is a dizzying mess (e.g. to handhold some tragic third party API) and the other is a trivial sequence of instructions you'd understand even if dementia forced to read with a finger on the current line. That code wouldn't qualify as a problem so it isn't affected by the rule (but you might still de-duplify if you know that if it changes it should change uniformly)