The DECOR Method
The DECOR method and DETEX detection techniques to specify and detect code and design defects.
![]() |
DECOR: Detection of Design Defects |
- Description
- Related Papers
- Links
- Installation
- Usage
- Material
- Acknowledgments
- Detected Design Defects in
Description
DECOR is a method which instances are detection techniques for code and design smells. DETEX, our instantiation of DECOR, allows the specification and the detection of defects such as code smells and antipatterns using a unified vocabulary and a dedicated language. Ptidej is the front-end to the tool suite for evaluating and improving the quality of object-oriented programs, reverse-engineering object-oriented programs (AOL, C/C++, Java), and promoting patterns. Ptidej integrates DECOR as well as visualisations algorithms to ease the understanding of detected defects.Related Papers
Related papers are available on the publication Web page.Links
- DECOR in Flintbox.
- Video of Ptidej and DECOR : A video showing the use of Ptidej to reverse-engineer an open source program, QuickUML 2001, and then to identify design patterns and code and design defects.
- An alternative version to this page.
Installation
- DECOR is a plug-in of the tool suite Ptidej.
- Ptidej is available upon request, please contact Naouel Moha or Yann-Gaël Guéhéneuc.
Usage
- You must first select the root of the directory where are the class files of the program to be analysed. Only class files (bytecode files) are necessary for the analysis.
- Then, select the defect(s) to be detected from the design defect list.
- Results will show in the Ptidej window. You can watch this video to see how to use the tool.
Material
- BNF grammar
- Examples of detection rules for the following defects: Blob, Functional Decomposition, Spaghetti Code, Swiss Army Knife.
- Textual Description of Spaghetti Code
- Excerpts of the Generated Detection Algorithm for the Spaghetti Code.
- Detection results in several systems. ERRATUM: Due to a human error, data related to the true results for Blob and Swiss Army Knife were lost. We were able to recover unfiltered data, which are available upon request. We deeply apologise for any inconvenience that this error may cause.
- Detection results in Eclipse v3.1.2.
- Recall of the detection results in Xerces v2.7.0.
| Design Defect Name | Suspicious Class | LOC, Name of the long method |
|---|---|---|
| Spaghetti Code | ||
| org.apache.xerces.impl.xs.models.XSDFACM | 426 LOC, buildDFA(CMNode) | |
| org.apache.xerces.dom.DOMNormalizer | 946 LOC, normalizeNode(Node) | |
| org.apache.xerces.impl.xs.traversers.XSAttributeChecker | 862 LOC, validate(Object, String, String, int, XSDocumentInfo) | |
| org.apache.xerces.util.URI | 285 LOC, initializePath(String, int) | |
| org.apache.xerces.impl.XMLScanner | 486 LOC, scanAttributeValue(XMLString, XMLString, String, boolean, String) | |
| Design Defect Name | Suspicious Class | Number of methods and attributes
declared, Data classes |
| Blob | ||
| org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl | 127 javax.xml.datatype.DatatypeConstants javax.xml.namespace.QName |
|
| org.apache.xerces.parsers.XML11DTDConfiguration | 95 org.apache.xerces.xni.parser.XMLInputSource org.apache.xerces.impl.dv.DTDDVFactory org.apache.xerces.impl.validation.ValidationManager |
|
| org.apache.xerces.impl.dtd.DTDGrammar | 184 org.apache.xerces.impl.dtd.XMLDTDDescription org.apache.xerces.xni.XMLString org.apache.xerces.impl.dtd.XMLContentSpec org.apache.xerces.xni.QName |
|
| org.apache.xerces.xinclude.XIncludeHandler | 222 org.apache.xerces.util.SecurityManager org.apache.xerces.xni.XMLString org.apache.xerces.util.XMLSymbols org.apache.xerces.util.HTTPInputSource |
|
| org.apache.xerces.dom.DOMNormalizer | 92 org.apache.xerces.impl.dtd.XMLDTDDescription org.apache.xerces.xni.XMLString org.apache.xerces.util.XMLSymbols org.apache.xerces.xni.QName |
|
| Design Defect Name | Suspicious Class | Keywords |
| Functional Decomposition | ||
| org.apache.xerces.impl.xs.models.CMNodeFactory | end, handle, traverse, copy, init, reset, modify, check, prepare, create, parse, validate, start, configure, process, report | |
| org.apache.xerces.util.ParserConfigurationSettings | idem | |
| org.apache.xerces.impl.dv.xs.TimeDV | idem | |
| org.apache.xerces.impl.xs.identity.XPathMatcher | idem | |
| org.apache.xerces.impl.xs.traversers.XSAttributeChecker | idem | |
| Design Defect Name | Suspicious Class | Multiple Interfaces |
| Swiss Army Knife | ||
| org.apache.xerces.dom.NodeImpl | org.w3c.dom.Node org.w3c.dom.events.EventTarget org.w3c.dom.NodeList |
|
| org.apache.xerces.jaxp.validation.ValidatorHandlerImpl | org.apache.xerces.xs.PSVIProvider org.apache.xerces.impl.validation.EntityState org.xml.sax.DTDHandler org.apache.xerces.jaxp.validation.ValidatorHelper org.apache.xerces.xni.XMLDocumentHandler |
|
| org.xml.sax.helpers.XMLFilterImpl | org.xml.sax.ContentHandler org.xml.sax.ErrorHandler org.xml.sax.XMLFilter org.xml.sax.EntityResolver org.xml.sax.DTDHandler |
|
| org.xml.sax.HandlerBase | org.xml.sax.ErrorHandler org.xml.sax.DTDHandler org.xml.sax.EntityResolver org.xml.sax.DocumentHandler |
|
| org.apache.xml.serialize.BaseMarkupSerializer | org.xml.sax.DocumentHandler org.xml.sax.DTDHandler org.xml.sax.ext.LexicalHandler org.apache.xml.serialize.Serializer org.xml.sax.ContentHandler org.apache.xml.serialize.DOMSerializer org.xml.sax.ext.DeclHandler |
Acknowledgments
- We contacted developers involved in each of the systems of the validation to compute the precisions and recalls of the results, and to improve our specifications of the design defects. So far, we have received few answers but enthusiastic interest. Software engineers analysed inde- pendently our results for Log4J, Lucene, PMD, and QuickUML, and con¯rmed the results in Table IV. We thank M. Adamovic, C. Alphonce, D. Cutting, T. Copeland, P. Gardner, E. Ross, and Y. Shapira for their kind help.
