CSC223 2004F, Class 24: OOD Heuristics (2): Relationships Admin: * SAM TANG IS SOMETHAT DEAD MEAT * Missing or late: Evan, others * Should Jesse be permitted to design a four-year plan that includes no humanities outside of foreign language and no social studies? Yes, as long as SamR is not his advisor. * Take-home exam 1 assigned (and discussed) * In-class exam next Monday * Closed book (one hand-written page of notes permitted) * Written * Conceptual (I hope) * Why both kinds of exams? * Test different skills. * Final will be in-class, so at least one in-class is helpful. * Friday's homework (draw pretty pictures) is week 10's homework (Talk about slipping schedules.) * Questions on that homework? * Bring 'em on Friday * How should we do it? Override the paintComponent method for some component of your choice (probably a JLabel) * Two possible designs: * One big JLabel, each tile drawn at a different place * One JLabel for each tile * Topic for Friday: Graphics! Fun fun fun. Overview: * Preliminaries * Questions on the reading? * QUIZ! * Basics: * Ways in which classes/objects relate to each other * Obtaining classes to use * Class Design * Inheritance * Polymorphism * Association /Questions: What didn't you understand?/ What's the difference between containment and association? * In some languages, when you have an object as a field, you actually contain that object public class Foo { int x; } public class Bar { Foo foo; } * In some languages: The memory allocated to a Bar includes memory for a Foo * In other languages (such as Java), all objects are stored by reference, in which case the memory allocated to a Bar includes only space for a reference to a Foo. * In languages which have "real containment" (memory includes memory for the contained field), the first kind of thing is "containment" and the second is "association" * In Java, all containment is association Are there ever cases in which X is part of Y and Y is part of X? * There may be, but they'll be a really hard thing to model in some object-oriented languages. * Such things will be handled by association-type containment * A vector of things that contain vectors sort of fits, but the two "vectors" are different QUIZ TIME! * TITLE IT: "Quiz on Surreptitious Case Analysis" * What is "explicit case analysis" mentioned in 5.12 and 5.13 and many other places in the text? * What is "surreptitious coupling"? How does it relate to the other kinds of coupling? * If you don't know an answer, you can say so and explain why you didn't ask during question time. * When you finish, you may leave. Answers on Friday