| I used to think that if something is done twice, it should be abstracted. Now, I'm a bit more careful. There's a pretty famous quote by Sandi Mentz: "Duplication is far cheaper than the wrong abstraction." https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstracti... Make sure that you're picking the write way to think about the task at hand, rather than blindly following DRY. There are times when even a single instance of a code call would be made clearer with abstraction, and there are times where having the same piece of code duplicated multiple times (or duplicated with one piece changed) is far clearer than trying to abstract it. This Reddit Comment also has an interesting take:
https://www.reddit.com/r/programming/comments/5txp5t/duplica... > The main purpose of abstractions is not to remove or reduce duplication, and not even to make code "reusable"; it is to make semantic patterns and assumptions explicit and, if possible, first-class. The further comments provide more discussion. --- I agree with the rest of your comment that refactoring and code-cleanup should be done in pieces and that, as with everything, striking the right balance is key. |