- The WhizO Toy Company is working on their first video game: A fighting game with dinosaurs. The figure below shows the result of their object-oriented analysis of the problem:
But the WhizO programmers are still pretty new at this --- they're not sure that they've done this right. Critique their OOA diagram and identify problems with it. (Hint: Yes, there is at least one.) You are welcome to use the back of this page as well.
Post your answers, comments, questions, concerns, etc. here
- Describe the relationship between:
- The Dinosaur and DinoParts classes.
- The Plateosaur and Raptor classes.
- The Dinosaur and Raptor classes.
- The size instance variable in the Dinosaur class, in the Plateosaur class, and in the Legs class.
I expect to see the following terms used in the above descriptions:
- Class
- Subclass
- Concrete and Abstract class
- Inheritance
- Gen-spec relationship
- Whole-part relationship
Post your answers, comments, questions, concerns, etc. here
- Below is the Smalltalk instance method which appears in the Dinosaur class:
attack: target
| location |
location := target position.
self aim: location.
self useWeapon.
This code might be used like this:
| aRaptor aPtero |
aRaptor := Raptor new.
aPtero := Pterodactyl new.
aRaptor attack: aPtero.
- What is location?
- What is target?
- What is position? Where is position defined?
- Assuming that the system was implemented as described in the OOA diagram presented earlier, could this code work?
Post your answers, comments, questions, concerns, etc. here
- Below is the Smalltalk instance method which appears in the Raptor class:
useWeapon
self extendClaws.
self strike.
- How does this method get called? Who calls it?
- Given the OOA diagram seen earlier, what might the Plateosaur's instance method for useWeapon do? Try to write the method.
Post your answers, comments, questions, concerns, etc. here
- Be able to explain the all-caps words in the following contexts:
- Ascii Count is a SPECIALIZATION (SUBCLASS) of Count (SUPERCLASS), which means that it INHERITS the structure and behavior of Count.
- Count is an ABSTRACT CLASS.
- A CountViewContainer sends messages to a particular INSTANCE of IntegerCount.
- Interfaces in Smalltalk are constructed from MODEL, VIEW, and CONTROLLER classes.
Post your answers, comments, questions, concerns, etc. here
Discussion from 2390 WINTER '96
- You are creating a simulation of an engine with a particular emphasis on modeling the flow of fuel through the engine (e.g., if we were to cause a clogged fuel line, our model would show a lack of fuel to the carburetor and pistons).
- Identify at least FOUR classes that you would need to (1) create the Problem Domain component and (2) create the Human Interface component. Identify which are which. (This does NOT have to be ALL the classes you would need, but it must be SOME of them.)
- Using the graphical notation used in Coad and Nicola, show how your classes would relate.
Post your answers, comments, questions, concerns, etc. here
Discussion from 2390 WINTER '96
- Consider the Vending Machine simulation discussed in class. The list below identifies the classes which were the central ones in implementing the Vending Machine.
- Identify which of these classes are models, which are views, and which are controllers.
- Describe (textually) the cascade of messages which result from hitting the Select button in the CashDeviceViewContainer.
Classes
CashDevice
CashDeviceViewContainer
DisplayBox
DisplayBoxController
DispensingHolder
Item
ItemViewContainer
ModelValueViewContainer
Post your answers, comments, questions, concerns, etc. here
Discussion from 2390 WINTER '96
- Below is one method from the Vending Machine simulation.
- To what class does this code belong? What does it do?
- Write a brief comment describing what each line of this code does.
dispense: itemToDispense
self isEmpty ifTrue: [^false].
(self itemIsDispensable: itemToDispense) ifFalse:
[^false].
self printItem: itemToDispense .
self activateDispenser.
self disconnectWithItem: itemToDispense.
^true
Post your answers, comments, questions, concerns, etc. here
Discussion from 2390 WINTER '96
- You have been asked to create a simulation of an airport with a particular emphasis on modeling the flow of airplanes (e.g., how long does an airplane have to wait to land or to take-off?) Identify and Describe at least FIVE classes that you would need to (1) create the Problem Domain component and (2) create the Human Interface component.
- Be sure to identify which are Problem Domain and which are Human Interface classes.
- Be brief, but think about what it takes to describe a class.
Post your answers, comments, questions, concerns, etc. here
Discussion from 2390 WINTER '96
- You are a consultant to the WhizO Toy Company ("Makers of toys for tots of all ages"). WhizO is considering a shift to an object-oriented software development process. If they do make such a shift, you're in for big bucks as the consultant who leads the way. First step is to respond to the specific concerns of the Manager of their Software Development unit:
- "We usually have multiple teams of developers working on different parts of the programs at once. How does object-orientation help us with that?"
- "We rely heavily on simulation when developing sophisticated toys. What would be absolutely perfect would be if we could take parts of our simulation and use it in the code for the real toy. Can we do that? How?"
- "What happens if we develop add-ons for a toy, like a new Laser Gun for our Omega Video Game System? Or if we develop a new variation on a toy, like the Phaser Range Finder Gun (which is like the Laser Gun)? Can O-O help our productivity in doing this?"
Post your answers, comments, questions, concerns, etc. here
Discussion from 2390 WINTER '96
- Okay, you've sold them. WhizO is now starting several software development projects using an object-oriented approach. You've been hired as the Answer Person for the teams. Help the programmers with these problems:
Post your answers, comments, questions, concerns, etc. here
Discussion from 2390 WINTER '96