in reply to Re^2: An Introduction to Literate Programming with perlWEB
in thread An Introduction to Literate Programming with perlWEB
BrowserUK likes to complain about the need to maintain code and documentation in parallel, but that problem doesn't go away if you move the docs to another file
Oh, but it does!
When writing documentation in a different file, people are far less tempted to start describing how the code works--opens a file; increments a variable; sorts an array; stuff which all but the most novice of programmers can (and if they are to do a descent job of maintenance work; should), work out for themselves, from the code.
Instead, they (should) concentrate on:
Documentation is for users; and should be written at the same level of abstraction that the user will use the exported api.
The code is description of the actual algorithms used and their implementation. And should be the only such description. It cares not for the external abstraction.
You should be able to re-implement the internals of an published (documented) API, using different internal algorithms, or even a different language, and the documentation should not need to be change at all. Nothing in the documentation should need to change, when the implementation changes, provided that the published API is maintained.
The purpose of comments is to annotate the code with additional (brief) information, pertinent to that code, that the language does not allow to be conveyed easily by the code itself. It should not repeat the code; nor the documentation; nor the language manuals.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: An Introduction to Literate Programming with perlWEB
by doom (Deacon) on Jan 20, 2009 at 00:58 UTC | |
by BrowserUk (Patriarch) on Jan 20, 2009 at 02:28 UTC | |
by doom (Deacon) on Jan 21, 2009 at 20:17 UTC | |
by BrowserUk (Patriarch) on Jan 22, 2009 at 12:12 UTC |