Skip to main content

Documenting the product code

C
Written by Cyberangels
Updated over 2 years ago

Why document the code?

1. You will be using your code several months from now.

Code you wrote months ago is often indistinguishable from code someone else wrote. You will look at a file with a fond sense of remembrance. Then a sneaky feeling of dread, knowing that someone less experienced, less wise, wrote it.

As you go through this selfless act of untangling things that were obvious or clever months ago, you will begin to empathize with your users. Documentation allows you to transfer the why behind the lines of code. In the same way that code comments explain the why, not the how, documentation serves the same purpose.

2. You want people to use your code.

You wrote a piece of code and released it to the world. You did it because you think others might find it useful. However, people need to understand why your code might be useful to them before they decide to use it. Documentation tells people that this project is for them.

If people do not know why your project exists, they will not use it. If people can't figure out how to install your code, they won't use it. If people can't figure out how to use your code, they won't use it. If you really love your project, document it and let others use it.

Basic example

Resources


This will suffice as a header, with a list below it. URLs will be linked automatically.

README

Your first steps in documentation should go in your README. Code hosting services will render your README to HTML automatically if you provide the appropriate extension. It is also the first interaction most users will have with your project. So having a solid README will serve your project well.

What to write

Be sure to give your users all the information they need. First, you need to ask yourself who you are writing for. In the beginning, you generally only need to appeal to two types of audiences:

  • Users

  • Developers

Users are people who simply want to use your code, and don't care how it works. Developers are people who want to contribute to your code.

What problem does your project solve.

Many people will come to your documentation trying to figure out what exactly your project is. Someone will mention it, or they will Google a random phrase. You should explain what your project does and why it exists.

A small code example

Show an eloquent example of what your project would normally be used for.

How to get support

Mailing list? IRC channel? Document how to get help and interact with the community around a project

Did this answer your question?