re: Stop trying to be so DRY, instead Write Everything Twice (WET) VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Anyone who thinks that maintaining even two copies of a piece of code is easier than one subroutine or function should not be allowed in a team. ...
 

Sorry, I explained badly. The original code was duplicated so there were two copies of it, then those two were duplicated so there were four copies, and so on, doubling each time. (There were some minor differences between copies that were easy to parametrise).

The point is that each copy and paste was a crime in itself, even the first one that only created two copies of a fairly short bit of code.

Saying to yourself, "I'll abstract that later if I need to" is just not good enough as it risks the copies diverging in ways they shouldn't and leaves it up to the next guy to find, understand and fix your mistake or to perpetuate it by applying the same fix in multiple places. Experienced programmers avoid duplication because it makes maintenance harder.

code of conduct - report abuse