3 ms·
It helps a lot to only extract common code that has a clear purpose. If I find myself naming a method "doThisThingThisOtherThingAndLogSomeStuff" then it's not a
by salmonellaeater 6y ago
It helps a lot to only extract common code that has a clear purpose. If I find myself naming a method "doThisThingThisOtherThingAndLogSomeStuff" then it's not a good refactor. On the other hand, "markStaleRows" or "enforceTreeInvariants" have clear purposes that help future engineers make intelligent decisions about how to use these functions and how they should evolve. I want to build in to the common code answers to the questions "should I call markStaleRows or roll my own code?" and "should I make this code change in the calling function or in markStaleRows?".
- Ma8ee 6y agoAnd if you have a function that is called markStaleRows, everyone better use it, because when I need to change how stale rows are marked, I will change this function and nothing else. I won’t go through the whole codebase trying to find if someone might have written some inline code somewhere else trying to do the same thing.