DEV Community

Cover image for How documentation can improve code quality
Ravina Deogadkar
Ravina Deogadkar

Posted on

How documentation can improve code quality

Hey there, you might be working on many projects and deadlines have caused you to rush the code to production.

And after a long time when you come back to your project, you might feel lost and your code no longer feels familiar to you. Everything feels messed up and the code no longer makes sense to you.

In this article, I will discuss how we can improve code quality and make it more readable and easily understandable.

When it comes to a good project what things just come to your mind? Something user-friendly, accessible, compatible, and so on makes the quality of the project. But from the code's perspective how would you improve code quality?

  • Readable

  • Easily understandable

  • Useable

How do we achieve this? good documentation

The secret to good documentation is to write it while you're writing the code. This helps ensure that no one needs to make assumptions about how something works, or is calling lengthy meetings to gain a working knowledge of a feature.

Here are five concrete steps you can take to write good documentation before it’s too late.

Be precise

Be precise about what the code does and what problem the code resolves. Underline the clear input to the function and the output returned by the function along with a short description of what it does.

Explain decision

Explain why that code was needed and what impact will it have on the input values. elaborate more in detail on what challenges you ran into and how you overcome them.

Reference and links

Links to issue tracker or any tools or anything useful that help you to drive the project in the right direction. You can add links to readme files, installation guides, and relevant issues.

Code snippets

Lastly don't forget to add examples and code snippets. Code snippets help a developer to get the practical perspective of your working model

Readme

Readme files in your project add up a clear knowledge and high-level understanding of the project from a developer perspective. The readme should highlight the prerequisite for the project and the steps to get started with the project. The readme should explain the clear intention of your project with a summary.

Documentation lives alongside the code as an equal player in our software. It's easy to forget supporting details after even just a short break from your project. To best set up your future self for success, document all the things you’ve established, Infrastructure as Code, or a fleeting future roadmap idea — To best set up your future self for success, document the things! Whether it’s a process you’ve established, Infrastructure as Code, or a fleeting future roadmap idea — write it down!

You can find best practices at google docguide

Happy Coding!...

Top comments (0)