Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In-line documentation getting out of sync is a purely organizational problem. If documentation is valued by the organization inline documentation won't get out of sync.

It's the easiest to keep in sync. It lives in the code it documents. It's in the same version control repo and the same version of the source building a binary can build the docs. If it ever does get out of sync with the code it's the most straightforward to fix because it's the same process for fixing an issue in the code itself.



And presumably you can track down when the inline docs diverged from the implementation, and who did it.


Documentation isn't automatically checked. Tests and sample code are a better alternative, since you can configure things to give you a build error if they ever get outdated.


If you are changing some code that has inline documentation it's your responsibility to update it. If that is not your responsibility then it's an organizational failing. Keeping inline documentation up to date and clean should be part of the organization's coding style guidelines.

Tests are not documentation. They only test a very limited "what" or "how" and give no explanation of "why". If it's closed source software and you're only shipping a binary, the tests do not go with the binaries so they're meaningless to third parties. Sample code isn't much better. Without the organizational pressure to keep it in sync with the code it's demoing and "why" explanations it doesn't provide a lot of useful insight for third parties.


Organizational pressure is a scarce resource, it's a waste to spend it on things that you can do with tooling. Keeping tests and sample code up to date involves more than just fixing compilation errors, sure, but the compilation error gets you reading and paying attention to the right piece of material.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: