How much duplicated code do you tolerate? [closed]

Refactoring: Improving the Design of Existing Code

The Rule of Three

The first time you do something, you
just do it. The second time you do
something similar, you wince at the duplication, but you do the duplicate
thing anyway. The third time you do something similar, you refactor.

Three strikes and you refactor.


Coders at Work

Seibel: So for each of these XII calls you’re writing an
implementation.
Did you ever find that you were accumulating lots of
bits of very similar code?

Zawinski: Oh, yeah, definitely. Usually by the second or third time
you’ve cut and pasted
that piece of code it’s like, alright, time to stop
cutting and pasting and put it in a
subroutine.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)