| Documentation strings can be stored with the function or macro definition in some way [http://arclanguage.org/item?id=989], e.g.: (def add (a b) "Adds two numbers." ...)
or, they could be stored in a separate docstring file: ((add "Adds two numbers.")
...)
To have the docstrings embedded in the source code implies that we want to have one true documentation for the code. But I might prefer Alice's documentation because it give explanations in great detail, someone else might prefer Bob's documentation because it is pithy, a third person might prefer Cindy's documentation because it has lots of examples, yet another might prefer Dmitry's documentation because it is written in Russian...I've gotten sucked into a number of useless arguments over the years, and I've found that many were based on a false assumption that there had to be one "official" way of doing something. Putting docstrings in with the source code makes that documentation the "official" version, and I foresee various useless arguments about the "official" version: for example, should it describe actual behavior even if it was unintended, or should it describe what the system "should" be doing (and then, what "should" the system's functionality be?) It is better to decouple the documentation from the source. Don't like the documentation? See a way to describe things better? Publish your own documentation file. You don't need anyone's permission, you don't need to try to get your changes accepted by some central gatekeeper, just do it. And if your documentation is better than Alice's or Bob's or Paul's, people will use yours. Embedding docstrings in with the source also imply that functions and macros should be documented as they are written, or, at the very least, when changing things around that old documentation that is no longer valid should be deleted. I have in various times in my life single-handedly implemented projects that a team of programmers failed to do, or implemented parallel features ahead of a team of programmers. A fun example is last year I was the only programmer a startup had when they discovered a major new business model of integrating with large businesses. They were in a typical startup catch-22 of not being able to make the sale without having a product to sell, but weren't able to fund (i.e., pay me to) make the product without having made the sale. So we (the startup and I) told the large business that we were starting them off with our API running in "test mode", and once they had done their system implementation to work with the API, we'd "turn on" our system and they'd be live. In actuality, the "test mode" was some stubs that I had thrown together over a day or two, and the "system" that we claimed we'd be "turning on" hadn't been written yet. As the team of programmers at the big business did their implementation to talk to our API, I wrote our system which implemented the API. When I think about the times like this when I was able to go fast, and other times when I got mired down and the project was a failure, a key realization for me is that my brain isn't very large. I'm only able to think about one or two things at once. A vital strategy for me is thus to be able to pare things down to absolute essentials. Thus, for me, not having to embed the documentation in with the source is a major advantage. As I am pushing code around, I'm able to look just at the code. Having documentation in view at the same time may seem like a rather minor issue... and maybe it is for people who either A) don't try to beat teams of programmers single-handedly, or B) have larger brains than I do... yet, again for me, every additional thing that is in view when I'm working on something diminishes my brain's capacity to work on the problem. If documentation were stored in a separate docstring file, then I could concentrate on the code, and when it was time to work on the documentation, I could go over and work on the documentation. I realize that embedding documentation with the source code is a feature offered, and indeed is the usual practice, of many languages; and it is one of those things that on the face of it sounds likes a good idea. Yet I recommend against it. I don't have a problem with those who want to embed their documentation in with their source code to be able to do that. I hope that as people write help systems and documentation viewers, they will support both styles: documentation that is written in a separate docstring file, and documentation that is embedded for those who want to do that. |