Tuesday, September 4, 2012

Tradeoff #1 - DRY vs. SRP

DRY vs. SRP

I think the conflict is clear. A method or class doesn't quite fit a new use case. Rather than extending the class or method a little bit, it might be better to clone it and change it to fit the new circumstance. Sure there's some repeated code between the two methods, the original and the spin-off, but you've stuck to SRP and I believe the result is more maintainable code. And in the future when you have time you can modularize and refactor the shared code.

No comments:

Post a Comment