oliverdavies.uk/source/_daily_emails/2023-09-22.md

904 B

title pubDate permalink tags
Documentation and comments get stale. Tests don't. 2023-09-22 daily/2023/09/22/documentation-and-comments-get-stale
software-development
automated-testing
static-analysis

I'm sure you've seen code comments that say the code will do something when, in fact, it does something different.

Or documentation that has become outdated and stale and no longer correct.

Automated tests and other tools, such as static analysis, are executable documentation, so they can't become stale.

If the implementation code changes and no longer matches the tests, the tests will fail, and either the implementation or test can be updated.

Then, if you need to refer to the test, as long as it's passing, you know what it shows is still applicable.

The same can't be said for markdown files, Confluence pages, Word documents or other static documentation.