I badly need some better strategies for making sense of large, twisty, underdocumented codebases.
My current "strategy" is
- grep for interesting words or phrases
- find relevant-looking functions
- look for their call-sites
- look up definitions of other functions called in those sections of code
- if I don't understand what a variable's for (almost certain) then look for assignments to it
- once I've identified all the bits of code that look relevant, stare at them until my eyes cross
- maybe put in a few printf's, try to make sense of the logs
- enter procrastinatory spiral of despair
- stress about losing job
- make more coffee
- repeat.
What do you do?