1. Original Entry + Comments2. Write a Comment3. Preview Comment


May 29, 2010  |  Why not have developers write the docs?  |  2903 hit(s)

Occasionally (or frequently, depending on the exact context in which you work), the idea will be floated that the way to do API documentation is for the actual developers to include comments in the code, and then to extract these. A number of tools exist to faciliate this, including Javadoc, Doc-o-matic, GhostDoc, and Sandcastle. (Wikipedia has a long list of such tools.)



The idea is appealing in a number of ways, among them:
  1. The developer developed the code, so they understand it best.
  2. When an API changes, it's easier to change comments in source code than to track down and update some document somewhere.
  3. That's one less technical writer you need to hire.
In my experience, tho, there's little guarantee that you'll end up with decent documentation. Here's a list of reasons why:
  • Most developers would rather code then write. This is all the more true, I think, when the writing consists of revising existing docs (comments) for an update.

  • Is it cost-effective to have developers writing documentation at coder rates? Maybe, maybe not.

  • Many developers are not strong writers, mechanically speaking -- not just spelling and grammar, but being able to articulate what it is they need to say.[1]

  • Many developers (or many that I work with, anyway) are not native speakers of English (assuming the target documentation is supposed to be in English).

  • Developers might not understand what the reader actually needs to know -- after all, it's generally obvious to the developer.

  • Developers are often focused on details like syntax or parameter definitions, not on the reasons why a piece of code exists or why the user might need to use it.

  • Developers often have a hard time grasping that the reader does not have the same knowledge that the developer does (cf The Rise and Fall of Homo Logicus).
You occasionally encounter an attitude among some developers that they have to write the docs because no technical writer could possibly understand their code. This is horse poop.

As a side issue, there's also the larger issue that API docs is to understanding a product as a dictionary is to understanding a language. Raymond Chen:
There's more to documentation than dry function descriptions, people! The function description is a reference; you go there when you already know what's going on and you just need to fine-tune a detail. The real learning happens in the overviews and articles. If you want to learn how to operate your radio, you don't read the schematic first.
I should add that I don't think that XML code comments are not useful. They can be part of the info (among many sources) that a tech writer uses to create docs. In individual instances where the various issues raised above are not issues, using developer-generated documentation for APIs (when used with additional material) will work just fine.

A final note: XML code comments can become the initial drafts that are fed into a community-supported doc effort. That can work. A limitation here, tho, is that improvements made by the community tend not to go back into the doc comments.


[1] I'll note for the record that there are many developers (I work with some) who write at least as well as anyone whose job title is "technical writer."




Brett Zalkan   29 May 10 - 2:45 PM

Are you tilting at windmills here? Or just counterattacking?

 
mike   29 May 10 - 4:26 PM

Well, this is a perennial issue that comes up around API docs, right? In this case, I was originally inspired to write this by a discussion about docs and open-source software:

Where's the Summer of Documentation?
http://ostatic.com/blog/wheres-the-summer-of-documentation

The premise of the article is excellent -- that what's needed for OSS projects it not (just) more and more code, but documentation as well. Down in the comments I found someone who had an attitude that none but developers could produce API docs, to which I added a comment.


 
Anonymous   07 Jun 10 - 2:30 PM

Perhaps we'll never see a Documentation solstice (much less an equinox) because...well...writing new code and building new features in code is just a lot more interesting than explaining new code or features.

I think there are lots of folk out there who experience little epiphanies about new features--or even fixes--that they can implement in code, then rush hot to their little keyboards and bang away obsessively. On the contrary, I think it's an extremely rare bird who's hit by the proverbial doc bolt from the blue and just can't wait to get that explanation down for others to see.

And, btw, Mr. Pope--excellent points all in this piece.


 
Jan Bultmann   31 Jan 19 - 4:48 PM

Still relevant in 2019! Now that's evergreen!