2 ms·
Code is the canonical source of truth. Tests are executable examples of code under use in different scenarios, usually showing both input and output. Textual
by necovek 5y ago
Code is the canonical source of truth.
Tests are executable examples of code under use in different scenarios, usually showing both input and output.
Textual documentation is an attempt to extract the most useful bits of the first two into a more manageable form, and potentially explain the reasons for said code's existence if it's not obvious. It will always go out of sync with code in small ways that will bite you, unless you've got executable documentation like some OpenAPI implementations or the venerable "doctests" in Python.
All of them are ways to learn about the API, or iow, "documentation".