skip to main content
article
Open Access

A behavioral notion of subtyping

Published:01 November 1994Publication History
Skip Abstract Section

Abstract

The use of hierarchy is an important component of object-oriented design. Hierarchy allows the use of type families, in which higher level supertypes capture the behavior that all of their subtypes have in common. For this methodology to be effective, it is necessary to have a clear understanding of how subtypes and supertypes are related. This paper takes the position that the relationship should ensure that any property proved about supertype objects also holds for its subtype objects. It presents two ways of defining the subtype relation, each of which meets this criterion, and each of which is easy for programmers to use. The subtype relation is based on the specifications of the sub- and supertypes; the paper presents a way of specifying types that makes it convenient to define the subtype relation. The paper also discusses the ramifications of this notion of subtyping on the design of type families.

References

  1. AMERICA, P. 1990. A parallel object-oriented language with inheritance and subtyping. SIC_I- PLAN 2,5, 10 (Oct.), 161-168. Google ScholarGoogle Scholar
  2. AMERICA, P. 1991. Designing an object-oriented programming language with behavioural subtyping. In J. W. DE BA~KSa, W. P. DE ROEVEa, AND G. ROZENBEaC (Eds.), Foundations of Objcct-Or~e~ted Languages, REX School~Workshop, Noord~z, Ut~'erho~Lt, The Netherlands, Ma!//June 1990, Volume 489 of ~NCS, pp. 60-90. NY: Springer-Verlag. Google ScholarGoogle Scholar
  3. BLACK, A. P., HUTCHINSON, N., JUL, E., LEVY, H. M., AND CARTER, L. 1987". Distribution and abstract types in Emerald. IEEE TSE i3, 1 (Jan.), 65-76. Google ScholarGoogle Scholar
  4. BRUCE, K. aND WP, GNER, P. 1990. An algebraic model of subtype and inheritance. In F. BAN- CILHON AND P. BUNEMAN (Eels.), Advances ia Database Program'mtng Lang~age, pp. 75-96. Addison-Wesley, Reading, MA. Google ScholarGoogle Scholar
  5. CARDELLI, L. 1988. A semantics of multiple inheritance. Information and Cornp~Ltat~on 76, 138-164. Google ScholarGoogle Scholar
  6. CARRINGTON, D., DUKE, D., DUKE, R., KING, P., RosE, G.,, AND SMITH, t). 1989. Object- Z: An object oriented extension to Z. In FOi~TE89, I~z~eTr~a~onal Co~}ere~c~ on Format Descrzpt~on Tech'nTq~Les. Google ScholarGoogle Scholar
  7. CUSACt<, E. 1991. Inheritance in object oriented Z. In Proceedings of ECOOP '91. Springer- Verlag. Google ScholarGoogle Scholar
  8. CUSACK, E. AND LAI, l~I. 1991. Object-oriented specification in LOTOS and Z, or my cat really is object-oriented! In J. W. DE BAK~<ER, W. P. DE ROEVER, AND G. R~ZP, NBEaG (Eds.), Foundations of Ob2ect Ortented Languages, pp. 179-202. Springer Verlag. LNCS 489. Google ScholarGoogle Scholar
  9. DAHL, O.-J., MYRHAUG, B., AND NVGAARD, K. 1970. SIMULA common base language. Technical Report 22, Norwegian Computing Center, Oslo, Norway.Google ScholarGoogle Scholar
  10. DHARA, I(. K. 1992. Subtyping among mutable types in object-oriented programming languages, Iowa State University, Ames, Iowa. l~iaster's Thesis.Google ScholarGoogle Scholar
  11. DHARA, K. K. AND LEAVENS, (J. T. 1992. Subtyping for mutable types in object-oriented programming languages. Technical Report 92-36 (Nov.), Department of Computer Science, Iowa State University, Ames, Iowa.Google ScholarGoogle Scholar
  12. DUb:E, D. AND DUXE, R. 1990. A history model for classes in object-Z. In Proceedings of VDtlI '90: VDilI and Z. Springer-Verlag.Google ScholarGoogle Scholar
  13. GARLAND, S. AND GUTTAG, J. 1989. An overview of LP, the Larch Prover. In Proceedzngs of the Thzrd Internat~o',~at Confere',~ce on Rewriting Technzq~es and Apphcaf~ons, Chapel Hill, NC, pp. 137-151. Lecture Notes in Computer Science 355. Google ScholarGoogle Scholar
  14. (~OGUEN, J. A. AND MESEGUER, J. 1987. Unifying functional, object-oriented and relational programming with logical semantics. In B. SHNIVER AND P. V~rEGNER (Eds.), Research D~rect~o~zs ~a Ob2ect O'r~e'atcd Prog~'a'mm~n9. MIT Press. Google ScholarGoogle Scholar
  15. GUTTAG, J. V., HOaNING, ff J., AN~, W~NG, J. M. 1985. The Larch family of specification lansuases. IEEE ,~oftcc.a,'e ~, 5 (Sept), 2 t-36.Google ScholarGoogle Scholar
  16. HALBERT, D. C. AND O'BRIEN, P. m. 1987. Using types and inheritance in object-oriented programming. IEEE Software 4, 5 (Sept.), 71-79.Google ScholarGoogle Scholar
  17. HAMMER, M. AND McLEoD, D 1981. A semantic database model. ACM Traus. Database Syst z'rns 6, 3, 351-386. Google ScholarGoogle Scholar
  18. HOARE, C. 197"2. Proof of correctness of data representations. Acta Infor~zatzca 1, 1, 271-281.Google ScholarGoogle Scholar
  19. KApUR, D. 1980. Towards a theory of abstract data type~. Technical Report 237" (June), MIT LCS. Ph.D. Thesis. Google ScholarGoogle Scholar
  20. LEAVENS, G. 1989. Verifying object-oriented prograsm that use subtypes. Technical Report 439 (Feb.), MIT Laboratory for Computer Science. Ph.D. thesis.Google ScholarGoogle Scholar
  21. LEAVENS, G. T. 1991. Modular specification and verification of object-oriented programs. IEEE Software 8, 4 (July), 72-80. Google ScholarGoogle Scholar
  22. LEAVENS, G. T. AND DHARA, K. K. 1992. A foundation for the model theory of abstract data types with mutation and aliasing (preliminary version). Technical Report 92-35 (Nov.), Department of Computer Science, iowa State University, Ames, Iowa.Google ScholarGoogle Scholar
  23. LEAVENS, G. T. AND WEIHL, W. E. 1990. Reasoning about object-oriented programs that use subtypes. In ECOOP/OOPSLA '90 Proceedings. Google ScholarGoogle Scholar
  24. LIPECK, U. 1992. Semantics and usage of defaults in specifications. In Foundations of {nformatzon Systems Spec~ficahon and Design. Dagstuhl Seminar 9212 Report 35.Google ScholarGoogle Scholar
  25. LisKov, B. }992. Preliminary design of the Thor object-oriented database system. In Proc. of the Software Technology Conference. DARPA. Also Programming Methodology Group Memo 74, MIT Laboratory for Computer Science, Cambridge, MA, March 1992.Google ScholarGoogle Scholar
  26. LISKOV, B., ATKINSON, R., BLOOM, T., hiOSS, E., SCHAFFERT, J., SCHEIFLER, R., AND SNYDER, A. 1981. CLU Reference A~r~nual. Springer-Verlag. Google ScholarGoogle Scholar
  27. LIsKov, B. AND GUTTAG, J. 1985. Abstraction and Specification in Program Deszgn. MIT Press. Google ScholarGoogle Scholar
  28. LISKOV, B. AND WING, J. 1992. Family values: A semantic notion of subtyping. Technical Report 562, MtT Lab. for Computer Science. Also available as CMU-CS-92-220. Google ScholarGoogle Scholar
  29. MAIER, D. AND STEIN, J. } 990. Development and implementation of an object-oriented DBMS. In S. ZDONIK AND D. ~{AIEB (Eds.), Read~gs in Object-Oriented Database Systems, pp. 167-185. Morgan Kaufmann. Google ScholarGoogle Scholar
  30. MEYEa, B. 1988. Ob3eci-oriented Software Consfruction. Prentice Hall, New York. Google ScholarGoogle Scholar
  31. MORGAN, C. 1990. Programming from Specifications. Prentice Hall. Google ScholarGoogle Scholar
  32. NELSON, G. 1991. Systems Prograrnmin9 w~th Moduta-3. Prentice Hall. Google ScholarGoogle Scholar
  33. SCHA~PEaT. C. COOPER, T., BULLIS, B., KILIAN, M., AND WILPOLT, C. 1986. An introduction to Trellis/Owl. In Proceedings of OOPSLA '86, pp. 9-16. Google ScholarGoogle Scholar
  34. SCHEID. J. AND HOLTSBERG, S. 1992. Ina Jo specification language reference manual. Technical Report TM-6021/001/06 (June), Paramax Systems Corporation, A Unisys Company.Google ScholarGoogle Scholar
  35. STROUSTRUP, B. 1986. The C-t--t- Programming Language. Addison-Wesley. Google ScholarGoogle Scholar
  36. UTTING, M. 1992. An object-oriented refinement calculus with modular reasoning. Ph. D. thesis, University of New South Wales, Australia. Google ScholarGoogle Scholar
  37. WING, J. M. 1983. A two-tiered approach to specifying programs. Technical Report 299 (June), MIT I~aboratory for Computer Science. Ph.D. thesis. Google ScholarGoogle Scholar

Index Terms

  1. A behavioral notion of subtyping

                Recommendations

                Reviews

                Tsun-Him Tse

                Subtyping, also known informally as inheritance, is an important notion in object-oriented programming, but may lead to unexpected problems if not handled properly. In order to ensure that intrinsic properties are preserved during the process of subtyping, Liskov and Wing propose two approaches. First, a constraint approach directly specifies history properties in terms of constraints, which provides the criteria to ensure that every method in the subtype preserves the properties of the supertype. Second, an extension approach specifies that the observable behaviors of every new method in the subtype must agree with the original methods of the supertype. This in turn ensures that history properties are preserved. Liskov and Wing discuss these two approaches in detail with respect not only to constraint and extension rules, but to invariant, signature, and methods rules. I have two observations. First, can the rules discussed in this paper be compatible with overriding__?__ For example, can we identify a set of rules that will help us preserve the desirable properties of the supertype, while avoiding the undesirable properties__?__ Second, I do not think the authors should claim that theirs is “the first work to deal with history properties.” For example, Cusack studied the history properties of inheritance in terms of traces, failures, and divergences in a communicating sequential processes<__?__Pub Caret> (CSP) context [1]. I enjoyed reading this paper. Numerous convincing examples are given to illustrate the arguments. The paper should be read not only by researchers but also by programmers who may not normally concur with the usefulness of formal methods.

                Access critical reviews of Computing literature here

                Become a reviewer for Computing Reviews.

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in

                Full Access

                • Published in

                  cover image ACM Transactions on Programming Languages and Systems
                  ACM Transactions on Programming Languages and Systems  Volume 16, Issue 6
                  Nov. 1994
                  243 pages
                  ISSN:0164-0925
                  EISSN:1558-4593
                  DOI:10.1145/197320
                  Issue’s Table of Contents

                  Copyright © 1994 ACM

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 November 1994
                  Published in toplas Volume 16, Issue 6

                  Permissions

                  Request permissions about this article.

                  Request Permissions

                  Check for updates

                  Qualifiers

                  • article

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader