Why commenting is important in programming?
While writing a program in script file, it is always recommended to add comments. Comments will help reader to understand following things -
- Project title and details about the same.
- Purpose of variables used, in mathematical equations.
- Declaration of given data variables.
- Units of the given variable and output variable.
- Assumptions made while working with mathematical model in your project.
Let's take a look at the example below -
A program without comments. |
In the example above we are not able to understand what is tC, CwT or rC. Even with oak and pine variables, its difficult to understand why those values? And what is its unit? What is the goal of the program?
But with comments reader can easily understand the purpose of program, goal of a programmer, the units of variable and nomenclature of input variables.
![]() |
A program with comments. |
A program with simple comments is very much easy to understand.
This will very much help you in your projects, when a project duration is across a year and when you want to refer your own first programs.
Try best practice and be a pro-programmer with simple and easy tips and tricks.
Comments
Post a Comment