'

Using design patterns and constraints to automate the detection and correction of inter-class design defects

Yann-Gaël Guéhéneuc École des Mines de Nantes, France

Developing code free of defects that is, code of quality is a major concern for the object-oriented software community. In this paper, we classify design defects as those within classes (intra-class), those among classes (inter-classes), or those of semantic nature (behavioural). Then, we introduce guidelines to automate the detection and correction of inter-class design defects. First, we note that design patterns and inter-class design defects relate to one another because they depend on the software architecture. Second, we assume that design patterns embody good architectural solutions and that groups of entities with organisations similar but not equal to design patterns represent inter-class design defects. Third, we assume that the transformation of such groups of entities, such that their organisations compl y exactly with the design patterns, corresponds to the correction of inter-class design defects. Then, we use a meta-model to describe the design patterns: their entities and the relationships among those entities.

We exploit these descriptions to infer a set of detection rules and a set of transformation rules. These sets extend the descriptions of the design patterns. A constraints solver with explanations uses these extended descriptions to recognise groups of entities with organisations similar to the described design patterns. The constraints solver associate explanations with each group of entities found. The explanations govern a transformation engine that changes the source code corresponding to the groups of entities such that their organisations comply with the associated design patterns. We apply these guidelines on two examples based on the Composite and Façade patterns using PTIDEJ. PTIDEJ is a prototype tool that integrates the complete guidelines. We conclude by presenting the limitations of our guidelines and the possible improvements.'