Skip to main content
Code age is the time since a file last changed. It is a stability proxy: long-stable code has had its bugs shaken out and can often be treated as settled, while recently-churned code is where the risk lives. Tornhill uses age to find “islands of stability” worth extracting into packages — and, inversely, old code that suddenly starts changing again deserves attention.

What mehen emits

The determinism wrinkle

Age depends on “now” — and wall-clock time would make the same repository state produce different numbers on every run. mehen pins “now” to the analyzed revision’s committer timestamp, so results are reproducible across runs and machines. The clamp at zero guards against clock-skewed commit metadata (a “last change” recorded after the analyzed revision).

How to read it

References

  • code-maat age analysis (repo).
  • Tornhill, A. (2015). Your Code as a Crime Scene. Pragmatic Bookshelf.

See also

  • Churn — how much has moved, regardless of when.
  • Bug risk — time-decayed weighting of bug-fix history.