JCSE, vol. 7, no. 4, pp.251-262, 2013
DOI: http://dx.doi.org/10.5626/JCSE.2013.7.4.251
A Catalog of Bad Smells in Design-by-Contract Methodologies with Java Modeling Language
Thiago Viana
Coordenacao de Sistemas de Informacao, Instituto Federal de Pernambuco, Recife, PE, Brasil
Abstract: Bad smells are usually related to program source code, arising from bad design and programming practices. Refactoring
activities are often motivated by the detection of bad smells. With the increasing adoption of Design-by-Contract (DBC)
methodologies in formal software development, evidence of bad design practices can similarly be found in programs that
combine actual production code with interface contracts. These contracts can be written in languages, such as the Java
Modeling Language (JML), an extension to the Java syntax. This paper presents a catalog of bad smells that appear during
DBC practice, considering JML as the language for specifying contracts. These smells are described over JML constructs,
although several can appear in other DBC languages. The catalog contains 6 DBC smells. We evaluate the
recurrence of DBC smells in two ways: first by describing a small study with graduate student projects, and second by
counting occurrences of smells in contracts from the JML models application programming interface (API). This API
contains classes with more than 1,600 lines in contracts. Along with the documented smells, suggestions are provided for
minimizing the impact or even removing a bad smell. It is believed that initiatives towards the cataloging of bad smells
are useful for establishing good design practices in DBC.
Keyword:
Java Modeling Language; Bad smells; Design-By-Contract; Refactoring
Full Paper: 156 Downloads, 2425 View
|