You are on page 1of 2

ISAM 5430 C# CLASS 2019S

Suppose we design a video game that manipulates objects of many different types, including objects
of classes Martian, Venusian, Plutonian, SpaceShip and LaserBeam. Imagine that each class inherits
from the common base class SpaceObject, which contains method Draw. Each derived class
implements this method. A screen-manager app maintains a collection (e.g., a SpaceObject array) of
references to objects of the various classes. To refresh the screen, the screen manager periodically
sends each object the same message—namely, Draw. However, each object responds in a unique way.
For example, a Martian object might draw itself in red with the appropriate number of antennae.
A SpaceShip object might draw itself as a bright silver flying saucer. A LaserBeam object might draw
itself as a bright red beam across the screen. Again, the same message (in this case, Draw) sent to a
variety of objects has many forms of results.
A screen manager might use polymorphism to facilitate adding new classes to a system with minimal
modifications to the system’s code. Suppose we want to add Mercurian objects to our video game. To
do so, we must build a Mercurian class that extends SpaceObject and provides its own Draw method
implementation. When objects of class Mercurian appear in the SpaceObject collection, the screen-
manager code invokes method Draw, exactly as it does for every other object in the
collection, regardless of its type, so the new Mercurian objects simply “plug right in” without any
modification of the screen-manager code by the programmer. Thus, without modifying the system
(other than to build new classes and modify the code that creates new objects), you can use
polymorphism to include additional types that might not have been envisioned when the system was
created.

Polymorphism promotes extensibility: Software that invokes polymorphic behavior is independent of the
object types to which messages are sent. New object types that can respond to existing method calls can be
incorporated into a system without requiring modification of the polymorphic system logic. Only client code
that instantiates new objects must be modified to accommodate new types.

We will be working on this project for about three weeks before April 25. April 25 will be the submission date. I’ll be
assigning you with a few Array and Exception assignments to help you prepare for the exam. This project will be a take
home exam, in which you will be prepared to complete the following tasks as a team. Then you will be writing up of
what you have added into your project. I’ll decide the percentage of contributions and the weight of your tasks (whether
it involves a lot of designs and tasks). You will be ranked in the class out 12 students.
In summary:
In-class Test 2 will be (weighing 50%):
Array problems with exceptions.
Take-home Test 2 will be Team OOP Project (50%), involving:
1) Team contribution (minimum requirement)
2) Individual contribution (extensions)—you will be writing an essay that’s a paragraph long about what you have
contributed into the project. I’ll determine the weightage. If this is a team effort, then you will be ranked lower
than other projects providing individual efforts. So please be as specific as possible.

Page 1 of 2
ISAM 5430 C# CLASS 2019S

The minimum requirement is given as follows:


You will need to use the following classes and interfaces:
1) Product Requirements
a) This is a game.
b) You can control your martian character with specific keys.
c) The Martian character can shoot a spaceship.
d) The spaceship can shoot back your Martian.
e) The game ends when the spaceship dies or the Martian dies.
2) Technical Requirements
a) Concrete ScreenManager that basically contains the game logic and the display logic.
i) You may choose to use threads to move the characters and detect the movements.
ii) Both Spaceship and Martian will shoot LaserBeam at each other, in which the Spaceship will shoot
automatically, and Martian will shoot manually.
b) Abstract ScreenObject that
i) a constructor that initialize the name property.
c) IDimension contains properties (decide whether they need get and set or just get):
i) X (position x)
ii) Y (position y)
iii) Z (z-index so that they overlap)
iv) Width (size)
v) Height (size)
d) Martian class extends the ScreenObject (Draw out “M” or some other symbol) implementing IDimension
e) Spaceship class extends the ScreenObject implementing IDimension
f) LaserBeam extends the ScreenObject
i) The laser beam is a “---” that moves across the screen towards the target.
3) Individual Contributions
a) Your designs should be clear and concise.
b) Follow Solid Principles: Single Responsibility Principle, Open-Closed Principle, Liskov Substitution Principles,
Interface Inversion Principles, and Dependency Injection Principle.
c) You may add additional space object (such as Mercurian) coming out of a space ship to attack the Martian.
d) The ideas are limitless.
e) Good features and designs can increase your rank in the class.

Page 2 of 2

You might also like