Abstract
The redefinition of a method in subclasses can completely change the semantics of the superclass method unless there are effective mechanisms that enforce the preservation of behavioral properties. Several approaches to behavioral subtyping— exact pre-post match, plug-in match, relaxed plug-in match among others—exist that enforce the preservation of behavioral properties. To maintain or weaken pre-conditions and to maintain or enforce post-conditions when redefining methods in extended classes— plug-in match—is the solution that is adopted, by construction, in the Eiffel language, among other assertion languages. This approach forbids the specification of a class of legitimate programs from which we present an example. We claim that relaxed plug-in match should be enforced instead, in order to accommodate these examples. Other approaches exist, as is the case of case analysis in JML and OCL, that allow the specification of those programs, but they do it at the cost of decreasing software extension. We propose a new way of building contracts that identify and express, in a natural and elegant way, the several contributions that method redefinition can bring, and that are expressive enough to specify extensible contracts for the above mentioned class of programs. These contracts ensure, by construction, that redefinition preserves behavioral properties.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.