Computer Science 223 Discussion Questions

Riel, Chapter 4

Discussion Questions submitted for Chapter 4 of Riel

Container Classes

  1. Are container classes completely contained by the containing classes? That is, can you only get to an object in a container class through on object of the containing class? Steven F
  2. It seems to me that the idea of a containment class is very similar to an agent class. What is a containment class other than an agent class with the capability of taking one request and fanning it out to the classes that it contains? josh vickery
  3. Are containing classes more than just a way to organize objects in a better way as shown in the meal classes? Steven F
  4. Is containment by reference really a containment relationship or a different type of relationship all together? -Jim Finnessy
  5. Could we see containment applied to our ongoing scheduler example? todd
  6. Can you discuss more about containment by values and containment by reference? -Jonathan Kensler
  7. The book implies that the relationship between a car and an engine is one of strong containment whereas that between a student and a classroom is of weak containment. What if there was a single student in the classroom? Would that make a strong containment relationship between a student and a classroom? ~yasir.
  8. Containment by value vs containment by reference: which one is better to use? Does Java support this distinction? Elias Vafiadis
  9. Could you please explain Heuristic 4.10? What does it mean by "as far down a containment hierarchy as the domain allows"? --Hisako
  10. I have a hard time seeing the dividing line between "containment" relationships and the fourth type of "uses" relationship in which an object gets built and then destroyed. What are examples of these two types of relationships? (-Nick)
  11. What is the most effective design strategy in dealing with the third type of relationship involving uses and containment (where we must consider strong or weak forms of containment)? --Khong
  12. what are examples of distributing system intelligence "vertically down narrow and deep containment hierarchies?" taha
  13. Please explain the difference between broad and shallow classes and narrow and deep classes? Anthony
  14. Could you further explain heuristic 4.8? todd
Uses Relationships
  1. Is there any possible reason to have two items within the same containing class have a uses relationship between them? Patrick Dowd
  2. Which type of uses relationship is appropriate for different situations?
  3. How would we implemented the uses relationship in the classes for our project that we discussed in class so far? ~yasir.
  4. What does Riel exactly mean by Heuristic 4.2- minimize the number of message sent between a class and its collaborator? George Yeboah
  5. How does Heuristic 4.2 relate to to the danger posed by having too many accessor methods? George Yeboah
  6. What is the author trying to demonstrate about the complexity of collaborating in figure 4.9 and the relevant descriptions? -Jim Finnessy
  7. why does complexity come only at a class level and not an object level in a uses relationship? taha
  1. What is the difference between implementing a constraint in a constructor and capturing constraint in a constructor? Anthony
  2. What is the distinction between centralizing the info for semantic constraints and decentralizing it? -Peter
  3. Can you give actual programming examples semantic constraints? -Jonathan Kensler
  1. Why should we minimize fanout in a class?
  2. How accurate is it to measure the complexity of a system by counting the amount of fanout? Elias Vafiadis
Other Questions
  1. What does the author mean by "users of data structures never access data directions"? (on p.62) Who are "users"? Other programmers, who wants to use the method somewhere else? --Hisako
  2. What are inline functions? And how do they eliminate the efficiency problem perceived with the narrow and deep hierarchies? Desi Dimova
  3. The idea of depth in classes while distributing intelligence horizontally seems at odds with itself, how is this reconciled?
  4. After reading Riel's examples I'm still not sure: When is it okay to violate heuristic 4.14? -Peter
  5. When one minimizes the number of classes which another class collaborates by creating a new class, doesn't that just create the new problem of proliferation of classes? Patrick Dowd
  6. How do we determine the extent to which the number of message sends between a class and its collaborator must be minimized, given that complexity is constant? Riel does not seem to give a concise explanation. --Khong
  7. What is a wrapper class? Is the containing class an instance of a wrapping, or is wrapping an instance of containment? Or is a containing class the same as a wrapping class? Desi Dimova
  8. How exactly are we supposed to avoid class proliferation if there is a hard limit on the number of objects per class? When is which heuristic more important?
  9. By further packaging classes into classes into classes the code does become more reusable, but is it always worth the added layers of complexity?
  10. Page 57 seems to suggest that having god-like classes is okay as long as they're not employed in a high level of design. Is this truly the case? (-Nick)
  11. The author mentions case tools at the very end of the chapter. Could we talk about case tools, I'm not familiar with the concept. josh vickery
  12. what is the effect on the complexity of a system if a class has many message sends to a collaborating class instead of just one?
  13. Should attributes necessarily encapsulate some data entities? How similar or different are they from the fields of an object? (Raz Magar)
  14. Is creating illegal objects like throwing Exceptions? (Raz magar)

This document is available on the World Wide Web as

created January 23, 2002
last revised February 11, 2002
Valid HTML 3.2!
For more information, please contact Henry M. Walker at