Inherited a codebase with zero tests and I'm terrified to change anything
First real job, and the main service has no tests, no docs, and the two people who wrote it have both left. Every change feels like defusing a bomb with the wire diagram missing.
I know "write characterization tests first" is the textbook answer, but where do you even start when you don't understand the code well enough to know what's correct behavior vs a long-standing bug? How did you get comfortable working in a genuinely scary legacy codebase?
2 comments
- 0
AnonymousAnon Been there, and it's genuinely stressful, so go easy on yourself. What helped me most: add logging around one flow and just watch it run in a real scenario. Reading the code cold told me nothing; watching the actual inputs and outputs is what made it click. Tiny changes, deploy often, keep the blast radius small.
- 0
AnonymousAnon Pin the behavior before you try to understand it. Pick the scariest function, write a test that just asserts what it currently does (even if it looks wrong), and now you can refactor under that net. "Working Effectively with Legacy Code" is basically the whole playbook for this exact feeling.