How old is most of the code in your project?
I have a love-hate relationship with old code. By "old", I mean code that nobody has touched for a long time. Sometimes, old code falls into the best category: battle-tested and doing its job. That kind of code deserves respect. Other times, it's the kind everyone avoids, because no one fully understands it anymore.
In almost every codebase I've worked on, there are a few classes like this. They're old and complex. They also seem to resist every attempt to keep them simple.
I tried hard to prevent that from happening. I followed object-oriented principles rigorously, which worked well, until I used SQL table inheritance, that was a hilarious fail. I also experimented with pure functions and composition(in C# 🤦), invested heavily in unit tests and other techniques. Each approach helped, but the reality is that some code gets old and complex over time.
Code age by itself is not a quality metric alone. Old code that has not changed for years is often stable, but it can also hide complexity, missing tests, and outdated assumptions. Changing it is risky because it usually concentrates a lot of business knowledge. On the other hand, code that changes frequently is usually more relevant, but also more prone to bugs and technical debt.
To identify hotspots you need to combine code age with change frequency. This combination highlights parts of the system that are both complex and under constant modification. Those areas deserve extra attention. Proper tools are refactoring, better tests, or clearer boundaries.
Your codebase is a planet with geological strata. Surface layers (new code) experience rapid change, mid-age strata accumulate technical debt, and deep layers (old code) are stable bedrock. It's usually risky to disturb these layers without proper tools (tests). At the core lie critical dependencies with the highest blast radius; disruptions here cause system-wide earthquakes.
Fault lines appear where hidden couplings and low test coverage create instability. These danger zones trigger unexpected problems.