Reading Michael Feathers’ ‘Working Effectively With LegacyCode’, I found quite interesting his heuristics to trace propagation of effects to code:
- Identify a method that will change.
- If the method has a return value, look at its callers.
- See if the method modifies any values. If it does, look at the method that use those values, and the methods that use those methods.
- Make sure you look for superclasses and subclasses that might be users of these instance variables and methods also.
- Look at parameters to the methods. See if they or any objects that their methods return are used by the code that you want to change.
- Look for global variables and static data that is modified in any of the methods you’ve identified.