| ▲ | Stratoscope 5 hours ago | |
Your philosophy reminds me of my friend Caroline Rose. One of Caroline's claims to fame was writing the original Inside Macintosh. You may enjoy this story about her work: https://www.folklore.org/Inside_Macintosh.html As a counterpoint, the very worst "documentation" (scare quotes intended) I've ever seen was when I worked at IBM. We were all required to participate in a corporate training about IBM's Watson coding assistant. (We weren't allowed to use external AIs in our work.) As an exercise, one of my colleagues asked the coding assistant to write documentation for a Python source file I'd written for the QA team. This code implemented a concept of a "test suite", which was a CSV file listing a collection of "test sets". Each test set was a CSV file listing any number of individual tests. The code was straightforward, easy to read and well-commented. There was an outer loop to read each line of the test suite and get the filename of a test set, and an inner loop to read each line of the test set and run the test. The coding assistant hallucinated away the nested loop and just described the outer loop as going through a test suite and running each test. There were a number of small helper functions with docstrings and comments and type hints. (We type hinted everything and used mypy and other tools to enforce this.) The assistant wrote its own "documentation" for each of these functions in this form: "The 'foo' function takes a 'bar' parameter as input and returns a 'baz'" Dude, anyone reading the code could have told you that! All of this "documentation" was lumped together in a massive wall of text at the top of the source file. So: When you're reading the docs, you're not reading the code. When you're reading the code, you're not reading the docs. Even worse, whenever someone updates the actual code and its internal documentation, they are unlikely to update the generated "documentation". So it started out bad and would get worse over time. Note that this Python source file didn't implement an API where an external user might want a concise summary of each API function. It was an internal module where anyone working on it would go to the actual code to understand it. | ||
| ▲ | nicbou 4 hours ago | parent [-] | |
The map is not the territory! Documentation is a helpful, curated simplification of the real thing. What to include and what to leave out depends on the audience. But if you treat "write documentation" as a box-ticking exercise, a line that needs to turn green on your compliance report, then it can just be whatever. | ||