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

TOP OF THREAD FULL DISCUSSION
re: Just wanted to leave this here for people who are interested. "DRY is about Knowledge, Code duplication is not the issue." verraes.net/2014/08/dry...
 

Finally some sense in an article and comment thread filled with anti-sense.

You don't "abstract" to avoid duplicating code, you abstract to give names to bits of code so you can think about them easier; for example you don't make functions to reuse them, you make functions to give a name to that operations so you'll think about "create_basket" instead of whatever the basket code does, and work with that abstraction. You don't even need to have that function called twice, once is enough.

Reusing inapropriately code previously abstracted in an object or function might be bad, but "don't abstract unless you write it twice or three times" is worse.

 

This is true, but you have to be willing to spend some time making sure you came up with the right name. Which is of course one of the hardest things in programming ;).

code of conduct - report abuse