CS 1130: Transition to OO Programming
Diagraming Objects and Frames
Due in class or to CMS on Friday, February 13th.
This is a simple written assignment where you are going to diagram a few objects. It should not take more a few 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.
Before You Get Started
Unlike the previous assignment, we would like you to do this assignment on your own. The purpose of this assignment is to assess that you understand the material well enough to carry it out on the exam at the end of the course.
For this assignment, you must work on your own. Do not share your assignment with others; do not obtain or look at a copy of an earlier solution or a version from another sturent. Because purpose of this assignment is to assess your understanding before the exam, it only hurts you if you cheat on this assignment.
As with the previous assignment, you are to resubmit this assignment until you pass. However, for this assignment, passing is considered 85%. You do not have to get a perfect to pass.
We will not outline our grading scheme in this assignment. If you do not pass you will be told what to revise. Hopefully, everything should be correct within one revision.
If you do not know where to start or if you are completely lost, please see someone immediately. This can be the course instructor, a TA, or a consultant. Do not wait until the last minute. A little in-person help can do wonders. See the staff page for more information.
Most 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.
A 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.
When you diagram a folder (object), you should obey the following conventions:
For example, a folder for a class
When 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 Call
Frames 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.