By Walton Dell
Created: February 8, 1997
My favorite quote:
"Computers do what we tell them to do, not what we want them to do." - Unknown
Software is very complicated to create. A bug is usually a flaw in the logic or design of a program. It is a glitch, a mistake, etc. Bugs are very, very common. Way too common if you ask me. In fact, I can't even name one feature-rich program that is bug free.
You may wonder how this can be, but remember that programs usually have many more features than a single user ever needs. Other people may demand a feature you don't need. For example, a guy who uses one program at work, may need to be able to load that file type into a different program at home. Supporting this other file type adds to the complexity of the program.
With this complexity, it is easy for a mere human being to make mistakes. Modern software can have tens of thousands of lines of code (or even millions!). Not only is software huge and complex, but it also has to be written at a very fast pace if it is to compete in this market.
Unfortunately, there is not much you can do about bugs. First make sure you know what program is causing the error; Then you can look to see if there is a bug fix (update) for that program. If not, you can ask around or experiment to find a workaround. If there is no workaround, then your only hope for a fix at this point is to buy a better product if possible.
The following requires some understanding of programming:
How easy is it to make a mistake when programming? Consider the following program written in the QuickBASIC programming language:
SCREEN 13 DO CIRCLE (RND*320, RND*200), RND*20, RND*256 LOOP UNTIL INKEY$ = "Q"
This program is designed to display randomly sized circles, at random locations, and in random colors until the user presses the 'q' key to quit. The first line changes the screen mode to mode 13 (320 by 200 in 256 colors). The second line is the start of a loop. In the third line we use the CIRCLE command. It requires the following syntax:
CIRCLE (x,y), radius, color
The RND function creates a RANDOM number between 0 and 1, so for each parameter I multiply by the range I want. The last line uses the following syntax:
LOOP UNTIL condition
This tells the computer to go back to the beginning of the loop UNLESS the condition is TRUE. For condition, I test if the INKEY$ function (which takes one character from the keyboard) is EQUAL to the character "Q".
This program actually does what it is written to do, but if you press the "q" key without holding SHIFT or turning Caps Lock on, it WON'T STOP!!! This is because the computer sees the lower case "q" as different from the upper case "Q". To fix this bug I can use the UCASE$(text$) function which converts text to upper case. Here is the modified program:
SCREEN 13 DO CIRCLE (RND*320, RND*200), RND*20, RND*256 LOOP UNTIL UCASE$(INKEY$) = "Q"
However, I'd rather have the program stop no matter what key the user presses, so I'll change the last line again:
SCREEN 13 DO CIRCLE (RND*320, RND*200), RND*20, RND*256 LOOP UNTIL INKEY$ <> ""
The <> means NOT EQUAL. This way it will loop until the INPUT is NOT EQUAL to NOTHING. In other words, the program will stop when any key is pressed.
This is what the display looks like:
Click here to download a compressed zip file (CIRCLES.ZIP) containing the code file CIRCLES.BAS and the program file CIRCLES.EXE.
Copyright 1997-2006 by Walton Dell
Web Site: wdell.com