Refactoring with contracts

Design by contract is a practical methodology for developing code together with its specification. The contract consists of class invariants and method pre-and postconditions. As the code is refactored, specifications of internal units change with the code. There are mutual influences between the code and the contract. The assertions that constitute the contract are Java expressions; refactorings such as rename method must change these assertions as well as the code. The contract has methodological implications, which serve as preconditions on some refactorings; these must be checked before performing those refactorings. In addition, some contract modifications follow from certain refactorings, and can be done automatically. Development environments that support design by contract must take these influences into account. We report on the implementation in Eclipse of several refactorings that involve both code and contract. These show how contracts are modified in response to code changes, how contracts prevent certain changes, and how new contracts are computed for newly-generated methods and classes

[1]  Bertrand Meyer,et al.  Eiffel: The Language , 1991 .

[2]  簡聰富,et al.  物件導向軟體之架構(Object-Oriented Software Construction)探討 , 1989 .

[3]  Yishai A. Feldman,et al.  Jose: Aspects for Design by Contract80-89 , 2006, Fourth IEEE International Conference on Software Engineering and Formal Methods (SEFM'06).

[4]  Stephen Wolfram,et al.  The Mathematica Book , 1996 .

[5]  Yishai A. Feldman Extreme Design by Contract , 2003, XP.

[6]  Yishai A. Feldman,et al.  Discern: Towards the Automatic Discovery of Software Contracts , 2006, Fourth IEEE International Conference on Software Engineering and Formal Methods (SEFM'06).

[7]  Kent L. Beck,et al.  Test-driven Development - by example , 2002, The Addison-Wesley signature series.

[8]  Heike Wehrheim,et al.  Jass - Java with Assertions , 2001, RV@CAV.

[9]  R. Kramer iContract - The Java(tm) Design by Contract(tm) Tool , 1998 .

[10]  Michael D. Ernst,et al.  An overview of JML tools and applications , 2003, International Journal on Software Tools for Technology Transfer.