Human-Reader Aspect

Dim DateToday
'Initialize the variable
DateToday = Date
MsgBox "Today's date is " &DateToday & "."

The Second line is a comment. In VBScript, any text that follows the single quote character ( ' ) is treated as a comment. This means that the VBScript engine will ignore this text. This introduces an interesting point: if the script engine is going to ignore the text, why type it in at all? It doesn't contribute to the execution of the script, right? This is correct, but it excludes one of the most important principles of programming: it is equally important to write a script with human readers in mind as it is to write with the computer in mind.

Of course when we are writing a script, we must write it with the computer (or, more specifically, the script engine) in mind, because if we don't type it in correctly (that is, if we don't use the correct syntax), the script engine won't execute the script. However, programming is an inherently human-involved activity. Once you have written some useful script, you're probably going to have to go back to make change to a script. You wrote six months ago, if you did not write that code with human reader in mind, it might be difficult to figure out what in the world you were thinking at the time you wrote the script. Worse yet, what happens when one of your co-workers has to go in and make changes to a script you wrote six months ago? If you did not write that script to be readable and maintainable, your co-workers will probably curse you as they try to decipher every line of your code.

First
Next