Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003

Microsoft® Windows® 2000 Scripting Guide

« Previous | Next »   

Comments provide clarification or additional information about a script and the script s purpose. Comments serve a function similar to that of a narrator in a movie: The narrator tells you what the characters in the movie are thinking; comments tell you what the script writer was thinking when he or she wrote the code. Without comments, readers must guess at the script s purpose and why it uses one approach rather than another. Comments improve a reader s understanding of the script.

It is generally a good idea to comment all scripts except scripts that are used once and then discarded. At a minimum, you should comment the following:

Adding comments

A good narrator tries to avoid the obvious and to tell you only what you might not be able to determine for yourself. If the main character in a movie is seen walking along a river, the narrator will rarely say something like, "And then the main character walked along the river." Instead, the narrator might tell you why the main character is walking along the river, but only if the reason behind this might not be obvious, and only if this narration helps to clarify what is happening.

Comments should be added only in similar circumstances; that is, only if the reason for using the code is not obvious, and only if the comment helps clarify what happens within the script. You might consider these guidelines when adding comments to a script:


 Send us your feedback « Previous | Next »   

Категории