Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lecture 9 - Introduction to Programming in Java | CSIS 110, Study notes of Javascript programming

Material Type: Notes; Professor: Hanks; Class: Intro to Programming in Java; Subject: Computer Science Info Systems; University: Fort Lewis College; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 08/05/2009

koofers-user-8wy-1
koofers-user-8wy-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSIS 110 – Lecture 9
Quiz Results
mean 20.1
stdev 5
median 22
max 24
Distribution (after EC):
<15: 1 15-17: 2 17.5 – 19.5: 3 20 – 22: 1 22.5+: 5
Reading Assignment: Section 4.11. Potentially confusing. Read before Monday, and
again after lecture.
Last time: this keyword
Debugger
Open the mail project again. Create a server and two mail clients: One for Fred and one
for Bill. Send message from Fred to Bill, but don’t read it yet.
I’m going to be using a tool called a Debugger so we can see what is happens when Bill
tries to print his next email.
Set BP on first line of printNextMailItem. Then call this method for Bill. What
happens?
A new window comes up – this is the debugger window. It has some parts:
- Buttons at the bottom
- Three windows on the right for different types of variables
oDon’t worry about static vars – we don’t know what they are yet, and this
class doesn’t have any
oInstance variables – we can see the values of the instance variables as they
exist at this particular statement
oLocal variables – there aren’t any YET, because it hasn’t been created. We
stopped the program execution before the statement is executed.
So, with the debugger, we can stop the execution of the program to inspect the values of
the variables.
We can also use it to step through the program slowly.
Single Stepping
When we are stopped in the debugger, we can use the Step button to execute one
statement. [Do it].
pf2

Partial preview of the text

Download Lecture 9 - Introduction to Programming in Java | CSIS 110 and more Study notes Javascript programming in PDF only on Docsity!

CSIS 110 – Lecture 9

Quiz Results mean 20. stdev 5 median 22 max 24 Distribution (after EC): <15: 1 15-17: 2 17.5 – 19.5: 3 20 – 22: 1 22.5+: 5 Reading Assignment: Section 4.11. Potentially confusing. Read before Monday, and again after lecture. Last time: this keyword Debugger Open the mail project again. Create a server and two mail clients: One for Fred and one for Bill. Send message from Fred to Bill, but don’t read it yet. I’m going to be using a tool called a Debugger so we can see what is happens when Bill tries to print his next email. Set BP on first line of printNextMailItem. Then call this method for Bill. What happens? A new window comes up – this is the debugger window. It has some parts:

  • Buttons at the bottom
  • Three windows on the right for different types of variables o Don’t worry about static vars – we don’t know what they are yet, and this class doesn’t have any o Instance variables – we can see the values of the instance variables as they exist at this particular statement o Local variables – there aren’t any YET, because it hasn’t been created. We stopped the program execution before the statement is executed. So, with the debugger, we can stop the execution of the program to inspect the values of the variables. We can also use it to step through the program slowly. Single Stepping When we are stopped in the debugger, we can use the Step button to execute one statement. [Do it].

What will happen if I press the step button again? Press step a couple more times. Then press continue button – program will run until it gets to a breakpoint. Stepping into a method Set up message again, and get to the breakpoint. Use step once. Point out how the step function treats the method call as an abstraction – it treats it as a unit. What if we want to see what the method does? Press the step button to get to the item.print() statement. Then press ‘step into’. Object creation We’ve used the debugger to look at what happens when we try to print a message. What happens when we send one. Clear breakpoint, and set new one on first line of SendMessage method. Step into the constructor – this allows us to see in more detail how this works. Summary We’ve used a debugger to allow us to investigate a program while it is running. This helped us understand how the program worked – we can also use this tool to help us find problems in our code. This project used many of the same ideas as the clock-display:

  • abstraction
  • object interaction
  • objects creating other objects
  • internal and external method calls Lab/Homework Posted on course web site – due Monday, February 6. Your lab assignment is to get together with your partner to start working on it.