CSC 223 Grinnell College Fall, 2005
 
Software Design
 

Discussion Questions for Riel, Sections 5.11-5.20

Containment

  1. 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)
  2. what is containment by reference? (Elijah)
  3. Wouldn't is containment by reference the same as the 'fat interface' solution? (Jonathan)
  4. 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

  1. 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)
  2. 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)
  3. 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)
  4. Could you explain when inheritance should be used instead of an attribute that can take on different values? (Mike L.)
  5. Heuristic 5.15 tells us to be skeptical about derived classes. When should we use them (i.e. the derived classes? (Saugar)
  6. 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

  1. What is polling? (monica)
  2. 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

  1. 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

  1. How do you know when explicit case analysis is necessary? (monica)
  2. What is the difference between explicit case analysis and case analysis? (Mike L.)

Other Questions

  1. 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)
  2. Why does following Heuristic 4.13 become a problem when dealing with interrupt driven devices? (Gaurav)
  3. How exactly does heuristic 5.14 interact with the heurisitc that tells us to hide details about the program from a user? (Eric)
  4. Can you explain Heuristic 5.12 more clearly and give a better example? (David D)
  5. 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)
  6. I am confuzed about "dynamic semantic wrapper", could you explain it? (Sheng)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
  11. 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

created 27 Octoberber 2005
last revised 27 October 2005
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.