T-Th 9:05 |
CS 1110: Introduction to Computing Using Java Spring 2012 |
Main
About: Announcements Staff Consultants Times & Places Calendar Materials: Texts DrJava VideoNote Terminology Handouts: Lectures Assignments Labs Assessment: Grading Exams Quizzes Resources: CMS Piazza (link) Piazza (about) AEWs FAQ Java API Style Guide Academic Integrity |
Diagraming Objects and FramesDue in class on Tuesday, February 21 There is a PDF version of these instructions, if you would prefer to have that instead. This is a simple written assignment where you are going to diagram a few objects. It should not take more than 15 minutes do to this assignment. So even if you are busy revising assignment 1, you should be able to do this assignment as well. "Diagraming" is what we do in the lecture notes where we draw the folders to represent the objects and associated variables. It also includes the methods frames that we talked about in class. These are a way of giving us a visual repreentation of what is going on in the computer when it runs Java. The purpose of this assignment is to see if you can keep track of what goes where in an object. Diagramming ConventionsMost of our diagramming conventions follow the lecture notes. However, in some places the lecture notes cut corners in order to be able to fit all the information on the slide. We do not want you to do that here. Therefore, we make several explicit conventions. Diagramming VariablesA diagram for a variable should include the variable name, a box for the value, and a type. For example, here is a diagram for the variable x:
We sometimes dropped the type in lecture, but you should not do that for this assignment. Diagramming ObjectsWhen you diagram a folder (object), you should obey the following conventions:
For example, a folder for a class
Diagramming ClassesWhen you diagram a file drawer (class), you should obey the following conventions:
The following shows the basic structure of a class with all of the details removed
Diagramming a Frame for a Method CallFrames should obey the following conventions:
See the lecture notes for more details on how to create a frame for a method call. In this exercise, we will not worry about putting local variables in a frame. Furthermore, the instruction counter will start at 1. Assignment InstructionsThe Class
|