Duplication is far cheaper than the wrong abstractionPosted: August 27, 2015
Sandy Metz said that if you find yourself passing parameters and adding conditional paths through shared code, the abstraction is incorrect. Then you should go back:
- Re-introduce duplication by inlining the abstracted code back into every caller.
- Within each caller, examine the parameters that got passed in order figure out which bits of the inlined code you actually use.
- Delete the bits that aren’t needed for this particular caller.