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

Sp02 Final Exam Review: Whiz-O Toys

"We usually have multiple teams of developers working on different parts of the programs at once. How does object-orientation help us with that?"

OOP is ideal for this type of development, since each developer can work on a single reusable object, and if its coupling is loose and its cohesion high, they will be able to focus much more closely on the role of that particular object in the problem space instead of spending excessive time understanding other objects in the system and interactions of their object with those objects.

"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?"

An object aids in separating interface from implementation cleanly by providing an abstraction that can have different but consistent meanings in two different problem spaces. Thus, control code for the toy can depend on objects that perform the mechanical manipulation, and there can be another version of these objects in the simulation that instead achieves a similar effect on the digital representation of the toy, but for which the same control code works unmodified.

"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?"

Objects most effectively exploit this idea through subclassing, which allows code that is already written to use an abstract base object to automatically use specific types of that object that are developed at a later time without modification. For example, the OVGS can be developed to request input from an InputDevice object, which is later subclassed to make a LaserGun object, and then the laser gun's input can be acquired by the system without having to do anything else. Likewise, if the Phaser Range Finder Gun makes only small extensions or changes to the abilities of the Laser Gun, it can, in turn, be subclassed from LaserGun, overriding the appropriate methods and calling its superclass wherever it desires to maximize code reuse.

Derrick Coetzee

In the second part of this problem it might also be useful to consider implementing using MVC. The devisions that MVC creates would work well in this situation because even though you change one or two pieces, the others can stay the same. In this situation it appears as if the control and the view change as the code is moved from the simulation to the actual toy, but the basis is still the model, which could be easily reusable having used MVC.

Bill Branan

Link to this Page