Starting from:

$25

CSCI3901-Lab 2 Debugging Solved

In this lab, you will become familiar with debuggers.

While the defects in the programs of this lab may not be complicated, use the time to become familiar with how your debugger works before you are faced with complex code.

Do not resort to debugging in this lab using print statements.

Preparation
•    Download HfxDonairExpress.java, Ackermann.java, and LinkedListTest.java from Lab 2 in Brightspace

Resources

•    A debugger which allows inspecting variables, breakpoints, stack traces

Procedure
Lab steps

1.   Run HfxDonairExpress on some inputs. You do not need to check invalid input.

2.   Examine the output until you find an incorrect value.

3.   Set a breakpoint at the start of the program.

4.   Select a defect in the program.

5.   Run your program in the debugger and step through the program to identify where the defect happens in the code.

6.   Determine what could fix the defect.

7.   Implement your fix and re-test to ensure that the defect is fixed.

8.   Repeat until no defects remain.

Repeat these steps for Ackermann.java and LinkedListTest.java.

Analysis
What strategy or strategies for debugging are most effective for you?

What makes them effective?

For which conditions of the code will your strategies be effective or ineffective?

How can a debugger support your strategies?

Reporting
1.   In one file, list

•    The cause of the defects that you found.

•    The approach that let you locate the defect.

•    The approximate amount of time it took you to locate the defect.

•    The answers from the questions in the Analysis section of the lab.

2.   Generate a PDF from the document.

More products