View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Fall2001 Midterm Review: Analyze Student/Classroom Code

Link back to Fall 2001 Midterm Review

a.) Classroom and Student have a "has a" relationship because Classroom's have students. Classroom's and Students also appear to have vastly different properties. The only thing that they seem to share is the holding of a name. I think that one property alone is not enough to justify a "is a" relationship. Especially since one holds instances of the other. It would be hard to justify holding instances of your subclass in your base class(also hard to implement in some OO languages)

b.)
Student:
Attributes:
name
section
number

Responsibilities

Store and retrieve name
Store and retrive section
Store and retrive number


Classroom
Atributes:
colStudents
name

Responsibilities
Store and retrive name
Keep track of students added to it .

Jared Parsons


Nice, Jared. Question: Should there be a Student class? Under what conditions would you create one? Does the above analysis suggest creating one or not, and why? Mark Guzdial
From the code that we are given I would say a Student class could easily be replaced with a dictionary. If the student class showed some more functionality other than variable storage then it would be more advantageous to create one. Jared Parsons


Since a class should have both services and attributes. It seems that the Student only really has attributes, like the name and number. The responsibilities are simply accessor/modifier methods and not real services.
Shwetak Patel

I think that if the Student class is going to be implemented, then the class needs to be redesigned. From the code that I've seen, the Student class is not very reuseable. For instance, when creating a student, the student's name, section, and student number are required. The name and student number are unique to the student, but the section is dependent upon the classroom. The classroom should keep track of what students are in each section. The student may have more than one class and more than one section. So the section is irrelevant to the student. The section is relevant to the class.
Christopher Henke




Link to this Page