Re:Goodbye, Clean Code
by detaro on Saturday January 11, 2020 @04:56PM
(#22022613)
And in the other direction, when adding flags etc to a method that was created to reduce duplication, consider if splitting it into two "duplicate" copies or copy it to the call-site requiring the flag isn't the better alternative.
[ Parent
| on HN ]
Re:Goodbye, Clean Code
by danabramov on Saturday January 11, 2020 @04:58PM
(#22022634)
Yes. If extracting and deduplicating is in your toolbox, so should be inlining and duplicating.
Or, if possible, split up the helper into smaller units of functionality that can be combined as appropriate for different requirements. That could possibly work for the original article's problem, too.