4.5. Types of Program Errors

There are three basic types of program errors. Obviously, your objective is to write programs that are totally free of program errors. Program errors are also referred to as program bugs. (The term "bug" was created because one of the earliest program errors ever detected involved a moth flying into the computer and short-circuiting the electronics. The process of removing program errors is called debugging.) While that goal is laudable, every programmer, no matter how seasoned, writes programs that contain errors. A skilled programmer, however, can detect, isolate, and correct program errors more quickly than a less skilled programmer. Also, experienced programmers do make fewer programming errors simply because of their experience. The lesson here is that you should expect to make a lot of program errors in the beginning . . . every beginner does.

In the beginning you will start off with the "flat-forehead" type of programming error. Those are the kind of errors that, when you do find them, you slam the heel of your hand into your forehead while mumbling, "How could I make such a silly mistake?" Relax. We've all made those mistakes. . .and still do! The key is not to get discouraged. View each program error as a challenge and learn from the experience. Alas, as your programming skills advance, so will the type of errors you make. While there will be fewer errors as you gain experience, those errors you do make tend to become more sophisticated and ...

Get Beginning C# 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.