Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: