Scholarly Portal
 







Eric Vanderburg coined his laws for programming in 2001. His laws apply to all programming but they are essential to any new programmer. Professor Vanderburg used the laws in his classes. The laws are as follows.

1. You allow whatever actions you do not explicitly deny.

2. Computers do only what you tell them to do. Nothing more or less.

3. A program that lacks explicit variable declaration is destined to error.


Law 1 - "You allow whatever actions you do not explicitly deny"

This law is concerned with security. Users of a program may accidentally or maliciously take actions that will hard the integrity of an application, its data, or the system on which it resides. Programmers must be vigilant in restricting the actions users of their software can take in order to minimize these risks.

Law 2 - "Computers do only what you tell them to do. Nothing more or less"

Computer programs are simply instructions to the computer. The computer will read those instructions and execute them. If an instruction is not given, it should not be assumed to be executed. This sounds simple but many programmers mistakenly assume certain actions will be taken. This confusion often happens when things are computerized. When asked how to take common task and turn that into a computer program, many people skip steps. People assume certain things will be completed automatically. For example, take a guessing number game. A number (X) is chosen out of a pool of available numbers such as 1-10. The user guesses a number (Y) and then X is compared to Y. Finally the program would tell the user whether or not they chose the correct number. This example is very simple but experiments showed that the step most often skipped was the check of X and Y. In real life we do not think of the check as a step. It almost naturally happens but computerization requires that step to be coded in the program.

Law 3 - " A program that lacks explicit variable declaration is destined to error "

Explicit variable declaration requires a variable used in a program to be defined with a name and a type. This is used to prevent errors such as incorrect usage of a variable and incorrect naming. Syntax varies by programming language but explicit declaration can be turned on with commands such as “Option Explicit” in Visual Basic.

 

Content Copyright © 2008 Eric Vanderburg