





















As code changes, documentation becomes stale over time.
This happens at big companies. This happens at small companies. Unlike code, documentation is not compiled or tested. The code is executed. If the code execution fails or produces incorrect results, it is fixed with much higher urgency.
Too much documentation, like too many tests, is a bad idea. It slows down engineers who might not be well-versed in composing English proses. Further, if documentation is say about 90% accurate, it is useless for onboarding or training new engineers, as they won’t know what 10% portion is incorrect.
What’s a better approach?
pip or yarn either as these tools keep evolving. Just link to the
correct command file like Makefile or package.json. If the link fails to resolve, it would be an immediate indicator that documentation is obsolete.pandoc, go docs and Java docs are great at generating automated documentation from the codebase. This is less likely to go stale. Even for external APIs like OpenAPI, one can automate documentation generation by adding relevant hooks directly in the codebase. For example, libraries like
fizz (for Go) and
swagger-autogen (for Node JS) can generate openapi.yaml and openapi.json spec directly from the code. Add a
CI task to automate this generation and then the specification would never drift away from the source code.此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。