Computer Science 223 Discussion Questions

Riel, Sections 5.14-5.20

Discussion Questions submitted for Sections 5.14-5.20 of Riel

Overriding a Base-Class Method with NOP

  1. Heuristic 5.17: Wouldn't it be more efficient to just NOP a base class method instead of copying all the methods but one to the derived class? - Elias Vafiadis
  2. Can you go into more detail about the NOP procedure? Patrick Dowd
  3. How do you solve the problem a, should be, derived class has already been implemented, but its base class needs to be added, if it is poor to make it a derived class with a NOP? Steve F
  4. Is it ok for a base class method to be changed to NOP method by the base class. There are two problems with it described in the textbook but what are the good things about the "fat-interface" solution, besides being easy for implementation? Dessislava Dimova
  5. The author goes to great legth to prove the logic behind heuristic 5.17. While this heuristic makes sense, is it not perhaps often more work than it is worth? -todd
  6. If one flips the hierarchy for not to have NOP, does it jeopardize the structure of the entire hierarchy? --Hisako

Optional Parts of Objects

  1. Can you talk further about optional containment, perhaps with respect to the project? -Todd
  2. Could you clarify containment by reference?
  3. How does containment by reference lead to a better solution for the optional component problem? (Sam Vanderhyden)
  4. Regarding heuristic 5.18, can you futher explain how to use containment by reference as a solution to optional components? Anthony
  5. Can you give us a better sense of how to detect when something there exists 'optional containment' and when we need inheritance? - Jonathan Kensler
  6. Could you discuss the advantages and disadvantages of containment by reference versus inheritance. Taha
  7. In section 5.18, it says adding an optional component doubles the number of derived classes. Is that because derived classes also have option to use or not use those components, which translates to 2^n possible combination of derived classes for n optional components added to the base class? In the same section referencing is mentioned as an alternative to inheritence, but does Java allow referencing? (Raz)

Frameworks

  1. Can you go over frameworks more? - Jonathan Kensler
  2. When exactly would we prefer to reuse components over frameworks and vice versa? ~yasir.
  3. What's the difference between a framework and a component? - Elias Vafiadis
  4. With regard to heuristic 5.19, how do you create a reusable framework rather than a component? -Peter Likarish
  5. What exactly is the difference between a framework and a component? (Sam Vanderhyden)

Inheritance and Derived Classes

  1. Could you please clarify the difference between a type of the class and a derived class. ~yasir.
  2. What is a good way of identifying derived classes? Taha
  3. In the case where a class contains and inherits from the same class, what happens to the heuristic that a class should not know about its container? Isn't it violated? Should that matter though? (Raz)
  4. While Riel says to be suspicious of derived classes with one instance, when would this be a good idea? Patrick Dowd
  5. Please explain how adding symbols to the house example led to as much class proliferation as Riel described, I didn't get it. -Peter Likarish
  6. Are there any cases of the types of polymorphism in, for example, our present project? Anthony
  7. Could you explain 5.15 better for me? George
  8. Heuristic 5.15 discourages to make derived classes. Then, when can we make them? It seems that it is a very thin line, whether to have derived classes or not. --Hisako
  9. What is the relation between 5.15 and 5.16? George

Problem Solving Perspectives

  1. How could we be sure that a problem is not without an optimal solution. In section 5.19, the author suggests that if there is no optimal solution to a problem we have to select one with a major drawback. But if we find a solution with a major drawback, and we are not sure that there must be another better solution, shouldn't we just go with the not so good solution? Dessislava Dimova
  2. It seems like one must spend a good deal of the design process defining the problem in terms of the object oriented paradigm in order to use it. (see section 5.19). If a problem seems to lend itself more readily to a different design paradigm, is it worth the time to work it into an object-oriented problem? josh vickery

Other Questions

  1. Can we have an IQ check in classes other than dog? I think that might be useful.
  2. Can you better define dynamic semantic wrapper? -Jim Finnessy
  3. Could you provide some examples about building a class or objects at runtime? Steve F.
  4. What would be an example of a time where someone would think that they needed to create classes upon start up, which led to the creation of heuristic 5.16? -Jim Finnessy
  5. How does section 5.14 explain how to use inheritance to hide the representation of a class? josh vickery


This document is available on the World Wide Web as

http://www.walker.cs.grinnell.edu/courses/223.sp02/read-riel-5c.html

created April 10, 2002
last revised April 12, 2002
Valid HTML 3.2!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.