Discuss with your group:
Write down your answers (and why you chose them!) in your group’s shared doc.
In this lab, you’ll be presented with a sequence of common debugging scenarios that we have noticed students encountering this quarter. For each one, there’s a brief description and a screenshot. Your job is to reproduce the error shown in the screenshot so that you see it on your own computer, and then describe the fix.
For each of the scenarios below, you should:
(This is good practice and gives some understanding about what we do as course staff when we see your EdStem posts!)
One skill we’re practicing here is reproducing bugs. In general when reporting issues or asking questions, there’s a question of reproducibility: whoever is seeing the error usually doesn’t have access to your running system, so reproducing the possible error from the given information is a key step. Sometimes screenshots are more helpful than just text, because they include the Visual Studio Code file browser or other similar visual details. Sometimes text is more helpful than a screenshot, because it can be easily copy-pasted to try out some code on another computer. You can always provide both to really help the person trying to reproduce the error, which is what we do in some cases below!
Here’s a screenshot of an error (right-click and “Open Image in New Tab” to see it if it’s too small). For reference, this one was using the lab 3 code repository. The programmer was trying to run the tests.
The repostory used is similar to this one, but pay attention to differences in grade.sh
:
bug.sh
contains the following code:
VAR=7
if [[1 -eq $VAR ]]
then
echo "it was 1"
fi
A project has the following file layout:
The contents of Code.java
is this:
import java.io.File;
public class Code {
public static void main(String[] args) {
File file = new File(args[0]);
if (file.exists()) {
System.out.println("File exists, yay!");
}
else {
System.out.println("The file does not exist :(");
}
}
}
Then this surprising result happens (the programmer was expecting the file to be reported as existing):
You’ve learned a lot this quarter! (We hope)
It’s useful to reflect on what we’ve learned. (Seriously, it helps with the learning process to do reflection.)
Think about what you’ve learned in labs, lecture, and quizzes this quarter. Think about a question or a problem that you can answer now that you would not have been able to at the begining of the quarter. Write it down in the notes.
Then, the other people in your group will try to answer it or talk about how they would go about solving the problem using things they learned in class. Did they have the same answer as you? Did they highlight any different parts of their learning?
The best learning here will come from questions that aren’t one-line answers (“how do you git push from the command line” won’t be a useful reflection, for instance). A task you can imagine doing with a few lines of a bash
script, a strategy for debugging or choosing good test cases, a workflow for setting up a project, a choice of Java feature for a particular program, and more could be good examples of things to discuss.
Spend the remainder of the time discussing general computing/CSE department/course/research topics with your group and tutor.
Some potential conversation starters to ask your tutor are:
Feel free to mix groups, listen in on other conversations, move around the room, and ask these questions to the lead TA, too!
Go back and pick a favorite lab report or a lab activity you really liked or did not finish. Write a post going into detail on how you did the task, doing the task in a different way, or applying something you learned later to the same task. For example (and you can use these ideas if you like):
StringServer
), use jdb
to set a breakpoint and answer the questions about the values of variables, fields, and arguments.find
/grep
etc) do the same exploration of several options for a different command or commandsbash
script (even if that was against the rules)There will not be a resubmission window for lab report 5, so do your best to be thorough, creative, and clear in your submission.