श्री Yogesh Ashok Powar

Personal Blogs

Code Explains What, Docs Explain Why

Thoughts on documentation and its overlooked role in development

We all agree on this, documentation is boring. It’s the first thing that gets dropped when deadlines breathe down your neck. But maybe it’s time we stop treating docs as a “nice to have” and start seeing it as a mirror for better software.

You don’t need to document everything

Seriously. Good code is self-explanatory.

If your function is named ‘fetchUserProfile’, and it takes a ‘userId’, I don’t need a comment saying “This function fetches the user profile”.

What we need to document are the things that aren’t in the code:

These are not visible in your code, and no amount of clever naming will fix that.

Documentation is self-analysis

It’s not just about sharing knowledge with others. Writing docs forces you to think. When you explain the why, you often discover things you never noticed.

That tiny moment of doubt leads to better questions. That’s gold. Documentation is where your design meets your doubt.

Where to Document Things

Not everything belongs in the same place. Here a practical guide to what to document and where to put it — starting from code and moving outward.

1. Code Comments

2. Git Commit Descriptions

3. ‘README.md’ (in each module/folder)

4. ‘docs/’ Directory (inside repo)

5. Wiki / External Docs (outside repo)

6. Code Annotations / Docstrings

Every level of documentation has its purpose. Use the right one for the right kind of information.

Validate Your Documentation

One simple way to check if your documentation is useful:

BTW, Good documentation isn’t just a record; it’s a conversation starter.

What’s next?

Use docs to talk to your future self and future teammates. Tell them the context. Tell them what might change. Tell them what to watch out for. Trust me, 6 months later, you’ll be glad someone did.

So yeah, code tells you what the machine should do.
Docs tell you why a human decided that’s the way to do it.

We need both.