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

TOP OF THREAD FULL DISCUSSION
re: Good post! I personally prefer to repeat as needed better than one complex code with several conditions just to accommodate all known use cases. Re...
 

This is usually a sign that your abstractions are weak and you should consider refactoring the code around what's repeated, too. Often it means you have too little abstraction and too much specialization in your functions/classes/etc.

Though as Niels points out, you might be trying to de-duplicated code that's not truly duplicated. Always question the code first, but if you can't come up with a better abstraction, it may be best to leave it for another time. I do agree that a little duplication is better than an over-complicated abstraction. The goal is to consolidate the knowledge and authority to one implementation as much as is reasonable.

 

I agree! question the code first before abstracting code :)

code of conduct - report abuse