At its core, legacy code is an oddly polite euphemism for code that is particularly hard to update or work with. It might be due to years of maintenance by an ever-changing roster of developers; or unforeseen new requirements that invalidate all sorts of internal assumptions; or a lack of energy invested into the more unglamorous parts of the code. But once it’s there in a codebase, it’s very difficult to get rid of, and so we as developers need to learn to work with it. Here are some tips that I’ve found useful when working with legacy code.