Computer Science 223 Discussion Questions

Riel, Sections 5.7-5.13

Discussion Questions submitted for Sections 5.7-5.13 of Riel


  1. Is there a clearer way of explaining polymorphism?
  2. Could you explain polymorphism in more detail and explain what would be a good example of polymorphism. Taha
  3. I understand the example of polymorphism on page 96, but I am still confused, why it is so useful in Object-Oriented programming. Could you explain, how having a hash table or pointers is an effective way of O-O programming? --Hisako
  4. To what degree should we try to limit the complexity of inheritance heirarchies?
  5. Could you clarify the difference between true polymorphism and just plain polymorphism? (Sam Vanderhyden)
  6. I could not quite understand the difference between true polymorphism and polymorphism. (Raz Magar)
  7. What are the main distinctions between polymorphism, true polymorphism, and pure polymorphism? --Khong
  8. What type of polymorphis do our appointment classes use? Do we follow the heuristics? (Nick W)

Base Classes and Abstract Classes

  1. Why should all base classes be abstract classes?
  2. why should the commonality of data/behavior be factored as high as possible in the inheritence hierarchy?
  3. Could you clarify the distinction between heuristic 5.10 and 5.11? George
  4. I don't understand the explanation of Heuristic 5.11. Could we go over it during class?
  5. Could you explain heuristic 5.11 in more detail that is, if two or more classes share only a common interface, then they should inherit from a common base class only if they will be used polymorhically. Taha
  6. If a method of a base class is going to be overwritten by all of its derived classes, what is the reason for even having that message in the base class? Steve F.
  7. In the scheduler implementation, should all base classes be abstract? Would that be a better design? -- Elias Vafiadis
  8. Can we make AvailableAppt an abstract class? That would violate heuristic 5.6. It seems to me that AvailableAppt makes sense as an abstract class, so is the heuristic invalid in this case? -Peter Likarish
  9. When is it best to use a abstact class, and when is it more appropriate to use a public interface? What are the advantages and disadvantages of each? -Jim Finnessy

Case Analysis

  1. It seems that the inheritanc hierarchy in Figure 5.15 can be obtained by starting with the base class 'Fruit' as well. What determines the preference over generalization to specialization versus the other way around? (Raz Magar)
  2. It seems like Heuristic 5.13 (Case analysis on the value of an attribute is often an error. Instead make and inheritance hierarchy) can lead to class proliferation. Why is this ok? (Sam Vanderhyden)
  3. Riel says explicit case analysis is usually wrong (5.12), when can it be correct? Patrick Dowd
  4. Could heuristic 5.14 be broadened to say that modeling of dynamic semantics of a class should rarely be handled with states as subclasses? -Todd
  5. It is not clear to me, if the heuristic 5.13 should be followed, that how abstract/concrete the case analysis should be at the beginning stage of O-O programming? How do we identify them? --Hisako

Dynamic Semantics

  1. With regard to appointments. Do we run the risk of violating heuristic 5.14 by having such diversified appointments in our schedule? It seems like they might be switching appointment types frequently. -Peter Likarish
  2. In what case might we run into this problem of modeling dynamic semantics with an inheritance relationship? Steve F.
  3. What advantages have abstract classes over interfaces? -Anthony Fynn

Other Questions

  1. What is the difference between interrupt-driven and polling systems? The definition on p103 is somewhat vague. Desi Dimova
  2. To what extent does generalization add to complexity and to flexibility? ~yasir.
  3. Riel says he does not like the method of examining an English description of the system. He then goes on to endorse essentially the same policy, how is class proliferation be avoided? Patrick Dowd
  4. Does Java use jump tables? -Todd
  5. Does proper object oriented design result in better software? When the goal is a working piece of software how much time can one justify spending on worrying about how well they are following the object oriented paradigm? josh vickery
  6. What is the difference between "messages" and "methods"? -George
  7. Are all messages in the form of methods? -Anthony Fynn
  8. What is runtime type discrimination? -Jim Finnessy
  9. Why can a polling solution be more inefficient? Desi Dimova
  10. Could you give some measure of reusability, showing how much people are generally able to get, compared with the optimal?
  11. How do we maintain optimal code reusability? --Khong
  12. What is the difference in implementation between inheritance and an object's dynamic semantics? ~yasir.
  13. Could you carify "polymorphic hooks"?
  14. On p. 102, is Riel suggesting that "hooks" in base classes designed to increase reusability in derived classes are *always* considered implementation details? What exactly does this mean? (Nick W)
  15. Imagine that we had a signifigant chunk of code, wrapped up in a class. If we wanted to extend the functionality of that class, but one one method was unacceptable, would it be better to cut and paste all of the code into a new class that did not contain that one method, or to extend that class, NOPing the one undesirable method? josh vickery

This document is available on the World Wide Web as

created April 8, 2002
last revised April 8, 2002
Valid HTML 3.2!
For more information, please contact Henry M. Walker at