3 ms·
> The Rule of Three: “When you’ve written the same code for the third time, that’s when you should stop and refactor it into an abstraction.” Small but very im
by diggan 1y ago
> The Rule of Three: “When you’ve written the same code for the third time, that’s when you should stop and refactor it into an abstraction.”
Small but very important change: "[...] that's when you should stop and consider refactor it into an abstraction". Sometimes it's needed, sometimes it's not, dogmatic following of that rule lacks the required nuance for real-life programming.
- rusk 1y ago“If it ain’t broke don’t fix it” I don’t believe it’s wise to add another iteration to working code just for the sake of aesthetics. There will come a point where you will have to write a fourth implementation and at that point you really should be considering abstraction and reuse of your three earlier known good implementations.