Scenario: I have a function that I need to tweak in some way (example; make it work slightly different in different places). For some reason I end up having to add something ugly to the code, either in the function or at existing call sites. Assume that the sum total "ugly" is the same in both cases.
The question is which choice should I pick and why?
Should I encapsulate it so I don't need to look at it or should I extract it so that it doesn't add semantic trash to the function?
What would effect your choice? What about if:
- The function will "never" be called except from the current locations.
- New calls to the function won't need the "ugliness".
- The function is really clean and generic right now
- The function is already a hack job.
- you wrote the function
- you didn't wright the function
- etc.