Must I always document or comment on my codes?

Software documentation.

Table of contents

No heading

No headings in the article.

In my opinion, this is a subject that has crossed the minds of many developers, especially newcomers. To some extent, that is to be anticipated. It is not a good practice for programmers to neglect commenting and documenting their code because they become so focused on getting their application to run.

Some developers are simply too busy building new features to bother with adding comments to their code. While it may seem easier and faster to dive headfirst into a program, there may be complications down the line with learning the ropes, keeping it up to date, and coming back to it after a long absence.

When I first started programming, I worked on a lot of different projects without commenting on or documenting my code. Years later, when I returned to some of those projects, I found that I couldn't comprehend them or make any necessary updates.

Image by DCStudio on Freepik

In my opinion, problem-solving is why programmers exist and why we write programs. With the help of programming languages, we can create applications that are both comprehensible to computers and humans; yet, when a program grows in complexity, it can become difficult to update, maintain, or even fully comprehend, especially when working in a group. We create more issues than we solve when we develop code that is difficult to understand, even for a computer scientist. Code documentation and code comments become useful at this point.

The two concepts, "code commenting" and "code documentation," are very different. You could think of comments in your code as a form of meta-data. They are merely a superficial addition to your code. In contrast to code documentation, which provides a more thorough explanation of your program and its functionality, your program's features and inner workings are laid out for the reader here. Despite common misconceptions, the two are distinct concepts.

You can use comments to suggest, in particular:

  1. What needs to be implemented or finished later?

  2. Locate Specific Code Components

  3. Explain why a line is written in a particular way.

  4. Aid in fixing any problems or performance concerns

However, documentation can be used to do things like:

  1. Clarify the program's logic and structure.

  2. Give instructions for installing or utilizing the software.

  3. Give specific examples.

  4. Specify the exact procedures and values that were used.

  5. Display expected user or program input or default values.

Photo by Shahadat Rahman on Unsplash

Though adding comments and documentation to our code will increase development time, the payoff will be greater productivity in the long run. More thorough documentation of our codes will make them simpler to implement. to emphasize while creating packages for other programmers to use. This must be done. It is one of the ways to identify a high-quality library, plugin, or framework.

So make it a point to practice documenting your code. You and anyone else experiencing or attempting to use it will greatly benefit from it. Although at first it may seem laborious, once you've internalized the process, it will become second nature. Clean them up as best you can in your code so they don't make your program untidy and unintelligible.

I believe this is for someone.

Thanks for your time.

Follow us for more Flutter and Android software development updates.