\slipar{

Objectives

With regard to actual software development, it is important to develop a style of class design that avoids errors and improves maintenance and reuse. The Law of Demeter provides a rule by which to organize and reduce dependencies between classes. Its underlying intuition is to avoid the visibility of objects embedded in other objects.

Points to emphasize

Hints

This section presents an example of the definition of a guideline for design, following  [LH89]. It includes an explicit characterization of the notions of a client, supplier and acquaintance. These definitions deserve to be emphasized.

Questions

  1. What would be your rendering of the Law of Demeter? Can you phrase its underlying intuition? Explain.
  2. Define the notions of client, supplier and acquaintance. What restrictions must be satisfied to speak of a preferred acquaintance, and a preferred supplier?

Comments

You may consult  [LH89] for a more detailed treatment and more examples of class transformations. You may also think of additional examples to convince students of the fact that ignorance is bliss. Is that a fact? }