- 1). Pull up your code on your computer screen.
- 2). Determine what your code is intended to accomplish. According to computer programmer Wallace Wang, keep your goal in mind while creating a new program or code. If you designed your code to add thousands of numbers together, it will not be helpful for you to test your code by inputting 300 letters.
- 3). Run a diagnostic test. Assuming that your code is designed to add thousands of numbers together, input 1,000 numbers into your code and instruct it to complete the task. If the program does not give you a numerical value, you know there is an error. If you receive a numerical value, check the math in another program (for example, Microsoft Excel) to make sure it is correct. If it is, your program is accurate. If the answer is incorrect, you know there is something wrong with your code. Look over each line of your code in detail to locate the error. Once you correct the error, run a new test.
- 4). Vary your diagnostic test according to your program. There are millions of types of codes and programs. Different codes require different diagnostic tests. A code designed to perform a different task according to which keystroke you hit can be tested by simply hitting each keystroke and making sure the accompanying task occurs. The basic idea, according to Wang, is to troubleshoot your program by making sure it does what you meant for it to do. If the program does not do exactly what you intended, you have more work to do.
previous post