Must I always document or comment on my codes?

Table of contents

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.

0
Subscribe to my newsletter

Read articles from Kenneth K. Amadi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kenneth K. Amadi
Kenneth K. Amadi

Kenneth Amadi is a Software Developer and Chemical Engineer. We offer mobile solutions by creating scalable, secure, reliable, and user-friendly mobile applications. We create cross-platform applications for Flutter and native Android. Working on several apps for purposes that have received favorable results and evaluations has given us a lot of experience over the years. Always delivering the finest is our goal and promote the efficacy of developed programs. Through the development of mobile applications, we are all attempting to address societal issues. We began our development career by initially creating native Android apps in Java and subsequently Kotlin. We currently work as a flutter developer and have extensive experience of the technology. We work well and cooperatively in teams and apply intuition while tackling tasks and issues. We are also an enthusiastic writer and SEO specialist. Feel free to contact us for any project, ideas or collaborations. We will be glad to be of any form of help and mentorship.