Safely Creating Correct Subclasses without Seeing Superclass Code







Deposit Papers 


Ruby, Clyde and Leavens, Gary T. (2000) Safely Creating Correct Subclasses without Seeing Superclass Code. Technical Report TR00-05c, Department of Computer Science, Iowa State University.

Full text available as:Postscript


Safely Creating Correct Subclasses
without Seeing Superclass Code
Clyde Ruby and Gary T. Leavens
A major problem for object-oriented frameworks and class libraries is
how to provide enough information about a superclass, so programmers
can safely create new subclasses without giving away the superclass's
code.  Code inherited from the superclass can call down to methods of
the subclass, which may cause nontermination or unexpected behavior.
We describe a reasoning technique that allows programmers, who have no
access to the code of the superclass, to determine how to safely
override and when it is safe to call the superclass's methods.  The
technique consists of a set of rules and some new forms of
specification.  Part of the specification would be generated
automatically by a tool, a prototype of which is planned for the
formal specification language JML.  We give an example to show the
kinds of problems caused by method overrides and how our technique
would be used to avoid them.  We also argue why the technique is
Keywords:  Downcalls, callbacks, subclass,
specification, specification inheritance, method refinement,
subclassing contract,
semantic fragile subclassing problem, Java language, JML language.
1999 CR Categories:
D.2.1 [Software Engineering]
Requirements/Specifications --- languages, tools, JML;
D.2.2 [Software Engineering]
Design Tools and Techniques --- Object-oriented design
methods, software libraries;
D.2.3 [Software Engineering]
Coding Tools and Techniques --- Object-oriented programming;
D.2.4 [Software Engineering]
Software/Program Verification --- Class invariants,
correctness proofs, formal methods,
programming by contract, reliability, tools, JML;
D.2.7 [Software Engineering]
Distribution, Maintenance, and Enhancement --- Documentation,
Restructuring, reverse engineering, and reengineering;
D.2.13 [Software Engineering]
Reusable Software --- Reusable libraries;
D.3.2 [Programming Languages]
Language Classifications --- Object-oriented langauges;
D.3.3 [Programming Languages]
Language Constructs and Features --- classes and objects,
frameworks, inheritance;
F.3.1 [Logics and Meanings of Programs]
Specifying and Verifying and Reasoning about Programs ---
Assertions, invariants, logics of programs,
pre- and post-conditions,
specification techniques;
Copyright (c) 2000 by Clyde Ruby and Gary T. Leavens.

Subjects:All uncategorized technical reports
ID code:00000221
Deposited by:Staff Account on 29 June 2000

Contact site administrator at: