Object-oriented programming: an objective sense of style

  • Authors:
  • K. Lieberherr;I. Holland;A. Riel

  • Affiliations:
  • 161 Cullinane Hall, College of Computer Science, Northeastern University, 360 Huntington Ave., Boston MA;161 Cullinane Hall, College of Computer Science, Northeastern University, 360 Huntington Ave., Boston MA;161 Cullinane Hall, College of Computer Science, Northeastern University, 360 Huntington Ave., Boston MA

  • Venue:
  • OOPSLA '88 Conference proceedings on Object-oriented programming systems, languages and applications
  • Year:
  • 1988

Quantified Score

Hi-index 0.02

Visualization

Abstract

We introduce a simple, programming language independent rule (known in-house as the Law of Demeter™) which encodes the ideas of encapsulation and modularity in an easy to follow form for the object-oriented programmer. You tend to get the following related benefits when you follow the Law of Demeter while minimizing simultaneously code duplication, the number of method arguments and the number of methods per class: Easier software maintenance, less coupling between your methods, better information hiding, narrower interfaces, methods which are easier to reuse, and easier correctness proofs using structural induction. We discuss two important interpretations of the Law (strong and weak) and we prove that any object-oriented program can be transformed to satisfy the Law. We express the Law in several languages which support object-oriented programming, including Flavors, Smalltalk-80, CLOS, C++ and Eiffel.