Every feature starts out in the hole by 100 points, which means that it has to have a significant net positive effect on the overall package for it to make it into the language. Some features are okay features for a language to have, they just aren't quite good enough to make it into the language.Once a feature makes it in to a programming language, it's in there forever. If you later realize it could have been better if done a little differently, you're stuck. Features tend to join to create combinatoric complexity, so each feature you add now means potentially big costs down the line.
When refactoring, I say "Every 'Extract Method' starts with minus 1 points".
The default negative reflects the cost of looking in two places to understand your program, where previously everything was in one place. The extracted method has to provide some additional value to justify its existence.
If the new method lets you eliminate duplication, add points.
If the new method is poorly named (worse than good / accurate / honest), subtract points. If the name more clearly expresses intent, add points.
If the calling method is now easier to follow, add points.
It's not a very high bar, but if you can't get to positive territory before merging to master, throw away the refactoring.
No comments:
Post a Comment