CSC223 2004F, Class 31: Choosing and Using Heuristics Admin: * Next project stage: * New groups * SamTheStickBug: SamLouisa, SamTang, SamMartin, SamChase * Beetle: Gene, Ryan, Omondi * Caterpillar: Luis, Evan, Jesse * Dragonfly: Merrick, Mark, Kat * Combine everything so far: * Two views * One model (the two-dimensional array) * One 'automated' controller (the bug) * Add: * 'Random' initialization of world * A mechanism for telling all bugs to do something * Coming: * Multiple hives * Controller UI * Competitions! * Presentations! * Prospies! * From Fairfield * Do people regularly insult your town? * Tell us about the University: It's fabulously weird * Demos! * Fearsomefoursome: * Cats are cute. * Pheremones are missing. * Interesting idea: High-level view has buttons that lead to low-level views. * Each button is linked to a particular tile and queries that tile for the objects in that tile. Calls createLabel or something for each object. Labels have images. * Can it redraw itself when the world changes? Yes, we think. * Glimmerers + 1 * No pheremones! * Scales nicely * Figures out a percentage of the width and height * Show location with setToolTipText (or something similar) * Menus! * Can we show a portion of the world that doesn't start at 0,0? * icons drawn with drawImage with width and height * Monday: Exams returned and discussed * Next two weeks: Design Patterns Overview: * Why read Riel, revisited * How today's class works * Choosing a relationship * Choosing how to get objects to use /Why are we reading Riel: Design Heuristics/ * Tells us lots of things we should do that are helpful (the heuristics) * The book claims to tell us how to design software, and this course is titled "Software Design" * Helps us make decisions as we design software * Reminds you of questions to ask (even if they're not expressed as heuristics) * E.g., "There are five ways you can obtain an object to use"; but "Sorry, I'm not giving you any heuristics about that" * Reveals some of the issues Object-Oriented Programmers think about * See the OOP Umwelt: "Kindof enviroment" "World View" * Example: Use polymorphism instead of "explicit case analysis" /Wednesday/ * The ways in which an object obtains other objects to use * Passed as a parameter to a method call * Contain that object * Contain a reference to that object * Create the object ("rich person's solution") * Ask an oracle for the object * Use a global object * Pass the request to an oracle for forwarding HOW DO WE MAKE THE CHOICE OF WHICH WAY SAM GETS A PEN? * First answer: Heuristics * Kat's first heuristic: If the object is used in only one method, you should either (1) receive it as a parameter or (2) create it yourself * The ways in which classes and objects relate * Use * Contain * Directly * Via association * Extend * Associate * Contain * Create * Other (default) ASSIGNMENT FOR MONDAY! Decide which heuristics help us make those decisions