Chapter 1. Dealing with Bugs

In This Chapter

  • Distinguishing bugs from features

  • Anticipating every move the user makes

  • Avoiding mistakes the easy way

  • Dealing with errors

Who knows whether it's true, but as the story goes, back when the first computer was built over a half century ago, it filled an entire room with circuitry (yet was about as powerful as one of today's digital wristwatches). One day, the thing was misbehaving, and some brave engineers climbed deep into the thing. (The version we're thinking of has them wearing white radiation suits, of course.) Deep in The Bowels of the Machine (sounds like a movie title), they found none other than ...an insect! A bug! It was a great big bug that had gotten messed up in the circuitry, causing the computer to malfunction. So the story goes, anyway. Today, we use the term bug to mean something that is wrong with a program. In this minibook, we show you how to track down bugs and fix them in your software. In this chapter, we talk about what exactly a bug is (and is not!), how bugs occur, and how you can try to avoid them.

It's Not a Bug. It's a Feature!

So we're using Microsoft Word, and all of a sudden, the program freaks out and saves our file automatically. We didn't tell it to do that; we didn't ask for it. Then we're using the same copy of Word, and we try to do a copy-and-paste procedure (that's called a use case, by the way), and suddenly the Font dialog box pops up. And then later, we're sitting with our laptops at Starbucks, and ...

Get C++ All-In-One For Dummies®, 2nd Edition 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.