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...
 

If I understand you correctly you’re saying: if I abstract away code, but in that code I have to cater for a couple of different use cases the code inside the abstraction becomes too complex, right?

There’s two answers:

1: it could be that the code you’re trying to deduplicate is not similar enough, in that case don’t deduplicate.
2: there are ways (patterns) to make the code inside your abstractions less complex (basically: less conditionals). For a nice illustrated example of this: youtu.be/8bZh5LMaSmE

code of conduct - report abuse