Answer 1:
There are many ways to look for programming
glitches or bugs--we call this debugging.
You will probably still have to run the program,
but if you set up your debugging strategy well,
you won't have to spend as long doing it.
The simplest way to debug, called print
debugging, is done by adding extra output to the
code. This is often the fastest way to fix a
problem. For example, if we have some guesses
about what parts of the code cause a glitch, we
can ask the program to print out the same
information before and after each part. Then, when
you run the program, if you notice that output
changing, you know where the glitch started, so
you can go back and take a closer look at what you
wrote.
A lot of other debugging strategies are for
code that already works and is being added to. For
example, writing a unit test can be helpful
for future changes you make to your program. A
unit test is a separate piece of code that just
runs important parts of your program and checks if
they worked the way you expected. Every time
you update your program, you run your unit test
again, and you will quickly find out if the new
changes broke something in it. A good unit test
will save you time compared to running the full
program manually a lot.
Click Here to return to the search form.
|