Discussion Questions for Riel, Sections 5.11-5.20
Containment
-
heuristic 5.16 tells us that their are two ways to handle an optional
component of a class. What exactly is meant by containment by reference? (Eric)
-
what is containment by reference? (Elijah)
-
Wouldn't is containment by reference the same as the 'fat interface'
solution? (Jonathan)
-
Using the example of a House class that contained an optional Heating part
that was implemented through containment by reference, wouldn?t programmers
have to rewrite the method for the Heating part each time they made a House
that had a Heating element? (Jonathan)
Inheritance Issues
-
Let's say that there was a class which was able to do all the functions of
a larger abstract class except for one. For example if AllDogs class had
bark( ), chase_cats ( ) and then there was a class called peacefulDog that
didn't chase cats but had bark( ) and a lot of other functions. Would one
then eliminate the chase_cats from the AllDogs class, and add a chase_cats
function to all the other classes inheriting from the AllDogs class? (Mike
C)
-
I dont understand why it should be illegal for a derived class to override
a base class method with a NOP method? Why would it be disadvatageous to do
so? (Gaurav)
-
If a derived class does not want to inherit all methods in base class, it
seems easier for derived class just overrides certain methods with NOP
methods. But this is considerred illegal according to Heuristic 5.17, Could
you explain more? (Sheng)
-
Could you explain when inheritance should be used instead of an attribute
that can take on different values? (Mike L.)
-
Heuristic 5.15 tells us to be skeptical about derived classes. When should
we use them (i.e. the derived classes? (Saugar)
-
What are the advantages to keeping single instances of derived classes as
objects? Can there be cases where making them into separate classes is
better? (Alex)
Polling
-
What is polling? (monica)
-
In Section 5.11, how does polling design works? What is the difference
between interrupting and polling? Why is it more efficient to use polling?
(chayapan)
Runtime Issues
-
Riel mentions several cases relating to "runtime" issues (in section 5.13,
5.16, 5.19). What does runtime actually mean? How do object relationships
we have learned perform at runtime? (chayapan)
Case Analysis
-
How do you know when explicit case analysis is necessary? (monica)
-
What is the difference between explicit case analysis and case analysis?
(Mike L.)
Other Questions
-
Heuristic 5.11 seemed similar to heuristic 5.10 that we covered for the
last class. Could you clarify the difference and may be explain 5.11 a
little better? (Saugar)
-
Why does following Heuristic 4.13 become a problem when dealing with
interrupt driven devices? (Gaurav)
-
How exactly does heuristic 5.14 interact with the heurisitc that tells us
to hide details about the program from a user? (Eric)
-
Can you explain Heuristic 5.12 more clearly and give a better example?
(David D)
-
On page 107, riel says "it is much more likely for applications to get a
new type than for a class to get a new state." What is an application type?
huh? (Elijah)
-
I am confuzed about "dynamic semantic wrapper", could you explain it?
(Sheng)
-
Are there any cases where it actually would be advantageous to build
classes at runtime (or perhaps use a completely different paradigm from
object oriented)? It doesn't seem totally unreasonable to use an
interpreter to solve the pricing strategy problem in the securities
example. (John)
-
What is Riel trying to say with his apple core story in Section 5.19 where
there is no optimal solution? He doesn't take a stance on either of the
two solutions, but he sort of implies that neither are correct since
they're "warping code". Would the NOP solution be better in general?
(Mike C)
-
Can you give a case where reusable components works better or fails
compared to reusable frameworks because Riel only gives examples where they
constructed reusable frameworks from the beginning and it worked. (David D)
-
For the fruit basket problem with no optimal solution, why is the first
solution not optimal? If all fruits have a prepare() function, why does the
fruit basket need a "tell me what you can do" message? (Alex)
-
What about using an abstract callback functor to solve the ATM card reader
problem in section 5.11? Perhaps a callback functor is too similar to the
abstract Device solution to mention, or it?s somehow not in-line with the
object-oriented paradigm. (John)
This document is available on the World Wide Web as
http://www.cs.grinnell.edu/~walker/courses/223.sp05/readings/riel-5b.shtml