Maybe obvious but also, don't deduplicate if it means adding options or making things too abstract. I don't know if I can think of a good example. Maybe you make a function that compares arrays of strings. Then you decide to add an option to make it case insensitive. Then someone comes along and decides they want to compare arrays of structs. So they had a comparison function option. Most times I've seen this pattern the code gets way harder to understand and more brittle. All the options etc cascade into spaghetti and changes start breaking things because so many paths expect some original behavior. Better to have just kept them separate, most of the time.