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.

Keywords

EiffelComputer scienceProgramming languageCorrectnessMathematical proofObject-oriented programmingSmalltalkSeparation logicProgrammerReuseDesign by contractTheoretical computer scienceSoftwareSoftware developmentMathematicsSoftware construction

Affiliated Institutions

Related Publications

Object-oriented programming with flavors

This paper describes Symbolics' newly redesigned object-oriented programming system, Flavors. Flavors encourages program modularity, eases the development of large, complex prog...

1986 ACM SIGPLAN Notices 302 citations

Object-oriented programming with flavors

This paper describes Symbolics' newly redesigned object-oriented programming system, Flavors. Flavors encourages program modularity, eases the development of large, complex prog...

1986 Conference proceedings on Object-orie... 198 citations

Publication Info

Year
1988
Type
article
Pages
323-334
Citations
170
Access
Closed

External Links

Social Impact

Social media, news, blog, policy document mentions

Citation Metrics

170
OpenAlex

Cite This

Karl Lieberherr, Ian M. Holland, A. J. Riel (1988). Object-oriented programming: an objective sense of style. , 323-334. https://doi.org/10.1145/62083.62113

Identifiers

DOI
10.1145/62083.62113