Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Summer2001 Midterm Grading Criteria
Q1 (10 points)
a) What did Alan Kay name as the first OOP language? Simula (1 point)
What did he name the first system of any kind that used OO principles? Sketchpad(1 point)
Note - no partial credit
b) What biological metaphor did Alan Kay use for OOP? cells (3 points)
Describe one way the metaphor matches OOP. reasonable answer (2 points)
c) Name three OO languages in use today. (1 point each)
Q2 (25 points)
a) Describe how message passing works in OO languages. In particular talk about the role of each of
messages, methods, and method selectors (i.e. symbols, in Smalltalk).
Clear distinction between messages and methods: messages trigger methods (4 points),
method selectors and lookup mechanism (3 points), description of return value (1 point),
message sends have a receiver (2 points), messages can have arguments (2 points)
Note - up to 12 points
b) What is the difference in these two sentences: "A is an instance of B." and "A is a subclass of B"?
Instance - A has all the methods and attributes of B. B is a class and A is an object. (3 points)
Subclass - A has all of the methods and attributes of B and it might have additional methods or attributes
that B doesn't (2 points)
Note - 2 points added for free
c) Name the three kinds of messages in Smalltalk, and give an example of each. (6 points)
unary: 16 squared.
binary: 12 + 2.
keyword: foo max: baz.
Q3 (20 points)
You are developing a city-simulation game somewhat similar to SimCity.
Write a method collectTaxes of class City which removes the appropriate amount of tax money
from each of the city's citizens, and adds that amount to the city treasury.
The following classes are in the system:
City, an entire city. It has an instance variable, citizens, which holds an OrderedCollection
of the city's citizens, each of which is a instance of Person. It also has an instance variable,
treasurySize holding an integer which is the amount of money in the treasury.
Person, an individual person. It has methods, moneyOwned, taxesOwed, and removeMoney:
which do what they sound like they do.
- overall structure - for each citizen, subtracting from citizen, adding to treasury (10 pts)
- syntax (-1 point for each error up to -3 points)
- for each method made up but not given in the problem definition nor defined by student, including accessors (-2 points)
- misc. correctness, such as removing correct amount of money (3 points)
Q4 (20 points)
Recall the third user interface implementation for Clock's, which is based on the changed/update mechanism.
a) How does the text display object (i.e., the ClockText) get activated when
the Clock's time changes each second? Be specific; "it uses changed/update" is not enough.
- Clock sends changed to itself (2 points)
- change is broadcast to all dependents (2 points)
- ClockText, being a dependent, is thus informed (1 point)
b) How does the text display object know what time to display?
It asks the clock (5 points)
c) Describe one approach that Clock could use instead of the changed/update mechanism,
and give one advantage and two disadvantages of that approach when compared to changed/update.
- 4 points for a good mechanism (see textbook)
- 2 points for each pro/con
Q5 (25 points)
Name two major problems with the design below, and for each, describe a way to modify
the design that would reduce the problem.
grading comments on your test
Link to this Page