Object Usage: Patterns and Anomalies
by
Andrzej Wasylkowski
Saarland University, September 2010.
Abstract
Using an API often requires following a protocol - methods must be called in a specific order, parameters must be appropriately prepared, etc. These requirements are not always documented, and not satisfying them almost always leads to introducing a defect into the program. We propose three new approaches to help cope with this problem:
* We introduce the concept of so-called object usage models, which model how objects are being used. We show how to efficiently mine object usage models from a program.
* We show how to use object usage model to find patterns of object usage and anomalous object usages. We have implemented the technique in a tool called "JADET" and evaluated it on six open-source projects. JADET was able to find insightful patterns, and had found defects and code smells in all six projects. In total, JADET found 5 defects and 31 code smells.
* We introduce the concept of operational preconditions. Traditional preconditions show the state an object must be in before being used as a parameter. Operational preconditions show how to achieve that state. We have created a tool called "Tikanga" that mines operational preconditions as temporal logic (CTL) formulas. We have applied Tikanga to six open-source projects, and found 12 defects and 36 code smells. This is the first time that specifications in the form of temporal logic formulas have been fully automatically mined from a program.
BibTeX Entry
@phdthesis{wasylkowski-phd-2010, title = "Object Usage: Patterns and Anomalies", author = "Andrzej Wasylkowski", year = "2010", month = sep, location = "Saarbruecken, Germany", school = "Saarland University", }