IT Commandment: Thou shalt document all thy works

Summary: If you don't, your selfishly undocumented software will rapidly fall into disuse, a neglected monument to your wasted effort.

it_command.gifReuse is at the heart of all today's hot IT trends: open source, SaaS, Web 2.0, mashups, etc. But how is anyone supposed to reuse a piece of code or a service if the documentation's inadequate? When I started out writing this commandment, it was headed "Thou shalt not reinvent the wheel". But then I realized why everyone always does: it's just too darn hard to do anything else.

Failure to document is thus one of the biggies of ZDNet's IT Commandments, high up in the mortal sin rankings with the likes of 'Thou shalt not kill'. For if you don't document your work, how is anyone else supposed to reuse any of it? From your greater sin flows a multitude of others' lesser transgressions.

And when I say 'document', I don't mean a few comments sprinkled here and there in the code for your own benefit (although frankly, that would be a start). Nor am I interested in a user manual that simply describes what the user already knows from looking at the application — and which no one, quite rightly, will bother to read. No, I'm talking about a veritable cornucopia of practical information: what the program does and how is just the start. Other people need to know what it was and wasn't designed for; how it performs and what the limitations are; how it's been tested and what the results were; along with a host of other things.

Documentation is the lifeblood of collaborative computing. If you don't know who else is going to share your program code and what they're going to use it for, you have to make everything within it crystal clear. If you're exposing a service interface rather than the underlying code, you have to provide even more information. Not just the information that pertains to how you yourself plan to use the service, but all the information that anyone would need to decide whether the service can be used for something you've never even thought of yourself.

Why bother? Because if you don't, your selfishly undocumented software will rapidly fall into disuse, a neglected monument to your wasted effort. It will never flourish as a vital component of applications you never imagined, enjoying a rewarding afterlife many years after its original purpose has faded into oblivion.

There is an IT heaven, and the stairway is paved with documentation.


Our IT Commandments:
  1. Thou shalt not outsource mission critical functions
  2. Thou shalt not pretend
  3. Thou shalt honor and empower thy (Unix) sysadmins
  4. Thou shalt leave the ideology to someone else
  5. Thou shalt not condemn departments doing their own IT
  6. Thou shalt put thy users first, above all else
  7. Thou shalt give something back to the community
  8. Thou shalt not use nonsecure protocols on thy network
  9. Thou shalt free thy content
  10. Thou shalt not ignore security risks when choosing platforms
  11. Thou shalt not fear change
  12. Thou shalt document all thy works
  13. Thou shalt loosely couple

Topic: Software

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

10 comments
Log in or register to join the discussion
  • I rarely agree with you

    But in this, a hearty AMEN!
    wolf_z
  • Yeah, right.

    Reuse REQUIRES:

    1) A database of functions
    2) Good communication
    3) Developers that will check the database FIRST

    Software Engineering requires:
    1) Documentation (Data dictionary, Project Spec.)
    2) Standard methodology

    You CAN do one without the other - but you really need both to make a difference. JUST documenting thy works is a step in the right direction, but if not followed up - is a step to nowhere.
    Roger Ramjet
  • I'm sure there are many great software components

    but I tend to ignore the poorly documented Open Source software. I would add that any Open Source project on SourceForge would do itself a GREAT favor by document, the points you specified in your article, on the Home Page of the project followed by release notes. I do not want to dig around looking to see if this is software I can use or that I want to contribute to.
    TJGodel
    • The mentality of a programmer

      Programmers often don't do a good job of documenting their work. The policy I've held myself to is if it's reusable, I document it well. I was trained that way in college. For application-specific code, I put notes occasionally, but by and large, unless what I wrote is esoteric, I hardly document at all. I blame it on the timeline of a project. Typically there's enough time to code, test, and have meetings, but little else. Typically if I've written something that's reusable within the company I work for, it's not written on a tightly defined schedule. It's done during "dead" time between projects. There's more time to document. I can get tired of documenting code though. I've found that my limit is doing it for about a week or two, straight. After that, I'd rather be doing anything else.
      Mark Miller
      • Hardly Document?

        "...unless what I wrote is esoteric, I hardly document at all." How about the poor programmer who must maintain the application? They are then asked to slightly modify the app, only to have to rewrite the entire thing because they can't figure out what and how it is currently done.
        DonG43
        • Why not document everything?

          Actually I mispoke a bit. They trained me in college to document everything, not just what is reusable. In a software engineering course I took they also told us to create and maintain requirements and design documents. The thing is, this is not entirely how the real world works. Unless you're working for a government agency or defense contractor or some such that has mandates about documentation creation/maintenance, and are therefore willing to commit huge budgets to software development projects (as in the FBI), documentation is going to be messy.

          Requirements and design documents are typically "first drafts" of a project, in my experience. They quickly go out of date, because no one, not even management, wants us to take time to go back and continually update it. Likewise with scheduled software projects, the emphasis is on keeping the cost low. So there's pressure to keep out activities that are "non-essential", lest the customer has to pay more for it. If anyone were to ask me whether keeping documentation was essential, and take me seriously, I would say yes. The thing is, management typically does not understand this. To them, productive work is working on code. That's moving the project forward, and they like that.

          I have to say in these situations in-code documentation is just not highly valued. I mean, the customer is hardly ever going to see it, and they're the ones paying for the project. I make an effort to document code that I think will be reused, or is unusual/esoteric in nature, but that's because I have a streak of altuism. I agree, someone's going to have to maintain it later, so they need to understand it, but asking me to do a complete job for everything is asking too much of me in these situations.

          Customers do like seeing requirements and design docs., so we produce those, but typically "design" means "what do the screens look like?", not control or data flows, not use cases, and certainly not class hierarchies. But like I said, once those docs. are signed off on, they quickly go out of date, because the customer changes their mind during the project. It always happens. From what I've seen, they haven't wanted to sign off on another version of the requirements and design docs. every time they change their mind. It's just assumed that the docs. are amended with change requests. And by the way, make a practice of getting ALL change requests IN WRITING: e-mail or Fax. Customers have a nasty habit of forgetting that they asked for something to be changed.

          Typically if the developers discuss things like use cases or class design, they do it on a whiteboard, which after discussion gets erased. One technique I've heard about is to take Polaroids or snapshots with a digital camera of the whiteboard before it's erased, and then put them in with the other design documents as amendments. It's not clean, but it's efficient for getting back to work, because nobody's going to sit down and formally edit/document what's been discussed. Development groups are not given the time for that.

          So, documentation ends up being a hodge-podge at best. Developers just have to deal with that.
          Mark Miller
  • I've always found it interesting....

    ...that developers have no problem writing code, but prose in any human recognizable language presents significant problems. We do not talk to each other in code, so I'm at a loss to describe why this is always an issue.
    rmcilree@...
  • Agreed, but...

    Programmers don't document for several reasons. It might be that they're lazy or selfish. It might be that they don't understand that good documentation is a part of the system and delivering it is part of doing a [b]Complete Job[/b].

    Another problem is that management may not value documentation enough and is therefore not demanding that it be a part of the project deliverables. But this hardly ever happens, right? None of us know managers that are clueless about software, right? None would ever say that getting it into production yesterday is better than making it right for tomorrow, right? None would ever make the mistake of assuming that the costs of an application stop at initial rollout and fail to consider the continued maintenance costs for the rest of the software's life, right?

    Too much documentation may not seem like a problem in most shops, but I think Scott Ambler's Agile Documentation philosophy makes a good point. He feels documentation should be enough to explain what a good developer needs to know, and no more. Heavy documentation can be so overbearing that it takes forever to write and read, becomes outdated, and becomes itself a maintenance hassle to keep up to date. The tricky part is figuring out that place between [b]enough[/b] and [b]too much[/b].
    Sundowner67
    • Ditto

      You're right on: programmer laziness/selfishness and management not valuing documentation are the reasons it does not happen. Why does management not value documentation? Because the costs of poor documentation are insidious and hard to measure. The cost of poor (or non-existent) documentation comes after the project is over and some other developer is seeking to understand existing code, design, or architecture. Countless hours are lost, usually in small chunks of minutes, trying to figure out the undocumented workings of existing software. Documentation is something that provides very little return in the short term but pays huge dividends in the long term. But, as you mention, most software development is executed with a very short term mentality, despite all lip service to the contrary. What about programmer laziness/selfishness? As a developer, I don't know what to say. I personally design, write and document code, I keep in mind constantly the fact that someone else will be looking at it one day. You would think that developers would want to do this because they're the ones hurt most directly by poor documentation. But if management doesn't actually value it and there's no time to do it...
      timorme
      • You have no idea :)

        Several years ago I worked for a consulting company that supplied programmers to work as "in house" programmers to a large corporation. We actually worked for at the corporation (for years on end) but were paid by our company.

        My immediate supervisor was named Steve. Steve was the ultimate "get it out the door ASAP, I don't care what it looks like" kind of programmer.

        I remember my shock the day he took me aside and told me "You comment too much, I don't like it."
        However I refused to reduce my commenting level and a few months later I was in a meeting where two others starting complaining about how difficult it was to modify programs in Steve's project.

        I think I managed to keep my grin down to a polite level...
        wolf_z