In this lab, you will become familiar with debuggers.
Working individually you will debug a few programs. 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 java, Ackermann.java, and LinkedListTest.java from Lab 2 in Brightspace
Resources
- A debugger which allows inspecting variables, breakpoints, stack traces
Procedure
Lab steps
- Run HfxDonairExpress on some inputs. You do not need to check invalid input.
- Examine the output until you find an incorrect value.
- Set a breakpoint at the start of the program.
- Select a defect in the program.
- Run your program in the debugger and step through the program to identify where the defect happens in the code.
- Determine what could fix the defect.
- Implement your fix and re-test to ensure that the defect is fixed.
- 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
- 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.
- Generate a PDF from the document.
- Submit the PDF and your Java files in Brightspace in the Lab/Lab 2 section of the course page in Brightspace.
Reviews
There are no reviews yet.