Comp212 Homework Assignment #1
Due 10:00 AM, Friday, Sept 7, 2001 in class.
No late homework will be accepted!!
Your mission, which you have no choice but to accept, is to come up with an
example that illustrates objects with polymorphic behavior. This is similar
to what was done with the pizza model in class. This includes, most importantly,
identifying the abstractions that are taking place.
You will need to perform the tasks described in parts 1-3 below.
There is a fair amount of writing involved here. This is deliberate. The
ability to do OOP rests on your skills in articulating your ideas, especially
the abstract models you create. OOP is all about understanding the problem,
not in writing tricky code.
Be specific, succinct and complete! Avoid long
prose descriptions, it only frustrates your graders.
- Describe the relationships between the set of objects in question and an
abstraction of those objects. Be sure to write strong supporting arguments
as to why you believe the abstract relationships applies to your example.
Note: "objects" are not limited to tangible, physical entities. They can include
actions, behaviors, senses, concepts, etc. too.
- Draw a UML diagram that illustrates your example. Fully explain the various
boxes and lines on the drawing. Remember, the graders already know how to
read UML diagrams, the point here is that you need to prove to them that you
do too.
Your diagram should include
- The classes that represent the various entities in your example.
- Any methods that are needed to show the pertinent behaviors. Include
only those methods that are germane to supporting your arguments of abstract
behavior!
- If your methods need to return something, just make up an appropriate
name for the type (class) and describe exactly what that type is supposed
to be in your documentation.
- Likewise, if your methods need input parameters of various types, make
up appropriate class names and describe them in your documentation.
- Any fields that are necessary. Clearly document what the fields represent
and how they are used.
- Write the pseudo-code in Java that matches your UML diagram. Pseudo-code
is syntactically correct Java code that won't really run because it is missing
things like certain externally defined types (as you might have defined in
part 2) and/or missing code bodies in the methods. The point here is to focus
on the class declarations, field declarations and method signatures.
- Write the class declarations, including access specifier(defend your
choice!).
- Write any field declarations needed, including access specifier(that's
an easy one!).
- Write the method signatures, including access specifier, return type,
and input types with appropriate variable names.
- Write the body of the methods. If you know exactly what Java statements
are needed, write them down and explain what they are doing. Once again,
prove that *you* understand the code. If you don't know the Java code
to do what needs to be done, clearly explain in a Java comment, what is
supposed to happen, including what is done with any input parameters and
what the return value should be.
Feel free to post questions and solicit opinions
on the newsgroup! Talk with your peers. If you can't convince them, you won't
convince the graders.
Grading guidelines:
40 pts - Does the student present a convincing argument that their example
illustrates an abstraction?
20 pts - Is the UML diagram technically correct? That is, does it match the
description in part 1? Are the correct lines and boxes used?
20 pts - Does the documentation for the UML match the diagram itself? Are
the choices for methods, return types, and input parameters consistent with
the description in part 1 and the part 2 documentation?
20 pts - Is the Java pseudo-code correct? Does it match the diagrams and
descriptions? Is the documentation complete and accurate?
Homework submission directions:
- Your descriptions and documentations must be typed! 50
points will be deducted for hand-written submissions!!
- Your diagrams can be hand-drawn, but must be neat and legible!
Up to 20 points will be deducted for messy drawings!!
- STAPLE YOUR PAGES TOGETHER! No staple = -50 pts!