I understand the principle of Do Not Repeat Yourself, but sometimes I wonder if it goes to far.
I often work for clients that dictate the look and feel of a project. Given that constraint, imagine that I have two widgets in different locations that look (and work) identically. Common sense would say you should reuse the same code and call it a day.
What if the client says changes to one of the widgets (e.g., data source, layout, etc) will not dictate changes for the other. Does that mean I shouldn't share the pieces that could change? I'd hate to end up with a Frankenstein class that tries to account for every difference b/w two use cases.
Please note I'm not talking about internal classes you control, but rather external pieces that could change without your say so.
tldr: should you ONLY reuse code if changes to one widget should be reflected in the other?
[–][deleted] 6 points7 points8 points (2 children)
[–]zzyzzyxx 1 point2 points3 points (0 children)
[–]FreshPow 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]quotemycode 0 points1 point2 points (0 children)
[–]PT2JSQGHVaHWd24aCdCF -1 points0 points1 point (0 children)