Comments save time at every stage of
the code's life cycle
In Code-Review
During Integration Testing
When you inherit someone else's code
During Maintenance and Enhancements
With Crystal REVS, you can easily add comments to the code you have
just implemented.
You can also add comments to the legacy code that you are trying
to understand.
After you decipher a few statements, Crystal REVS will help you
to add comments with just a few clicks.
Your next pass through the code will be a lot easier.
First, Crystal REVS helps you add comments to the objects
that are used in the statements.
A comment in the object's declaration is considered
to be the meaning of the object. For example:
int
id:
/* scope id NOTE: passed to getter
and setter */
When you wish to comment a statement,
Crystal REVS refers to the objects' meanings and prompts
you with comments for that statement.
Just click the comment-phrases of your choice to add the
comment.
Crystal REVS auto-formats the comments.
With
the two-step process described above,
You can provide an object's meaning in its declaration,
and reuse that meaning to comment the statements.
You get source code that is properly documented.
Crystal REVS saves the file as a plain ASCII text file. You
can edit it in Crystal REVS and your present editor too.
Suppose you are about to review the code shown below:
For example, what does this statement do?
nvars = fun->nvars;
Without comments, the code is hard to understand. You
lose valuable time.
The same code - after commenting
script = fun->script; /* Get interpreted bytecode descriptor */
minargs = fun->nargs + fun->extra; /* minargs = minimum number of actual args +*/
/* number of arg slots */
nvars = fun->nvars; /* Get number of local variables */
if( fun->flags ) /* if ( flags are available ) */
{ /* 2{ */
if( fun->flags & JSFUN_BOUND_METHOD )/* if ( bind this to fun-object's parent )*/
thisp = parent;
else
parent = NULL;
} /* 2} */
With comments, you can understand the same code in half
a minute.
The comments are simple. However, they are valuable because
they save a lot of time.
Comments are useful in generating comment-based flowcharts.
A comment-based flowchart is similar to a code-flowchart.
If a comment is present, the flowchart symbol displays
the comment instead of the corresponding code.
Comment flowcharts are easily understood by hardware,
systems, and test engineers.
You can obtain valuable input on design and test issues
related to your software.
Commenting helps you detect errors in the code.
While you are commenting, you are taking another look
at the function logic.
It helps you detect errors. Debug and test go faster.
The little amount of time that you invest in adding the comments
yields huge time-savings during the life of the code.