Improving the running time of the Topological Ordering algorithm by a constant factor. In class Graph: Node succ; Node n; succ.predecessors.add(n) succ.predecessors.remove(n) succ.predecessors.size() == 0 n.predecessors.clear(); The Law of Demeter says a class should interact directly with its collaborators and be shielded from understanding their internal structure. When we only take our direct dependencies, we minimize coupling and maximize reusability. We are interested in predCount and it is not a good idea to expose the details about predecessors. succ.predCount++ succ.predCount-- succ.predCount == 0 n.predCount = 0 You shouldn't have to care that Server contains EmailSystem, which contains Sender. You shouldn't have to care Node contains an ArrayList of nodes. See also: ~/.www/courses/se-courses/cs5500/f11/LoD