Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Sp2002 Midterm Review: Analyze Student/Classroom Code
Back to Spring 2002 Midterm Review
a. It seems that a classroom "has a" student. This is because the classroom doesn't share any attributes with student, besides name. This means that a classroom is not a student but has a number of students.
b. student - attributes - name,section, number.
services - Probably accessors and modifiers for each
classroom - atributes - name, students
services - add a student and keep track of all students
that have been added thus far.
Accessor and modifer for its name.
a. Actually, it seems the classroom and the student are closer than just a classroom having a student. The student has a 'section', which means that the student is probably only in ONE classroom. In other words, adding a student to another Classroom instance wouldn't make sense, as the section would be different.
b. Classroom has attributes: name, students.
has services: addStudents
Student has attributes: name, section, number
a. Okay. I agree that Classroom "has a" Student. Classroom probably has lots of students. It's not clear whether section has anything to do with the Classroom at this point. Since there is a why? a the endof this question I came to this conclusion because students are "added" to the classroom. If this follows the good design principle of makeing method names meaningful, I can gather that a classroom holds some list of students. There is nothing that says students communicate with classroom in any way.
b. Classroom can of course add students to it's list. It can also set it's name which probably means it can also provide it's name to callers. Class could probably also return it's list of students and remove a student. Students hold their name, number, and section and can probably return them. That's all I can seem to infer from the code snippet. Anything else? Maybe the classroom can seat the students by section. Maybe the classroom plans activities for the students by section. Who knows.
Link to this Page