1. Using Design Patterns and Constraints to
Automate the Detection and Correction
of Inter-class Design Defects
Yann-Gaël Guéhéneuc (guehene@emn.fr)
Hervé Albin-Amiot (albin@emn.fr)
École des Mines de Nantes, France
Object Technology
Soft-Maint S.A., France
International Inc., Canada
2. Design patterns
Constraints Inter-class
design defects
The Ptidej tool
To assess / to increase software
2/25
flexibility and understandability
3. Summary
n An overview of software quality
n A classification of design defects
n On inter-class design defects
n Design pattern modeling
n Design defects detection
n Design defects correction
n Case studies
n Conclusion and future work
3/25
4. An overview of software quality
n Viewpoints
– ISO/IEC 9126
• Functionality, reliability, usability, efficiency,
maintainability, portability
– ISO/IEC 14598
– Coupling, cohesion, method replacement…
n Maintenance = 75%
n Design defects
4/25
5. A classification of design defects
n Intra-class / Inter-class / Behavioral
Number: 39/61 (64%)
Detection–correction: 25%
Number: 13/61 (21%)
5/25 Detection–correction: 8%
6. On inter-class design defects 1/2
n Design patterns
– [Gamma et al. 1994]
• Quality architectural solutions
• Language independent
– General Smalltalk- or C++-level
• Domain independent
• Flexibility, understandability
– Other authors
6/25
7. On inter-class design defects 2/2
n Wanted software quality characteristics
– Flexibility
– Understandability
n Hypotheses
– Groups of entities similar to a design
pattern = Inter-class design defects
– Making these groups of entities closer to a
design pattern = Improving architectural
7/25
quality (flexibility and understandability)
8. Design pattern modeling 1/3
n Meta-model
– Describe the entities and elements in
design pattern abstract models
n Abstract model
– Describe a design pattern in term of roles
n Concrete model
– Link an abstract model to real code
8/25
10. ic
A Bas xample : Composite 3/3
E
Informal descriptions
from [Gamma et al.]
Instance of class Pattern
Translates into
Instance of class PInterface
Instance of class PClass
Instance of class PAssoc
Instance of class PDelegation
name() Instance of class PMethod
Pattern, PInterface, PClass, PAssoc,
10/25 PDelegation, and PMethod are
classes defined in our meta-model
11. Design pattern detection 1/4
n Design pattern abstract model
– Detection rules, i.e., constraints
• Roles as variables
• Relationships as constraints among variables
n CSP
– Source code for domain
– Abstract model for variables, constraints
11/25
12. ic
A Bas xample : Composite 2/4
E
Source code 1 Composite pattern abstract model Source code n
CSP CSP
Distorted
concrete
models
12/25
Composite pattern concrete model 1 Composite pattern concrete model n
13. Design pattern detection 3/4
n Distorted concrete models
– The design pattern
– Not quite
• Some constraints are not verified
n Back to our hypotheses
– Groups of entities similar to a design
pattern
13/25
14. Design pattern detection 4/4
n Explanation-based
Constraint
Programming [Jussien]
– Set of constraints justifying an action
performed by the PaLM solver
• Value removal
• Contradiction
– Strong interactivity with the user through
dynamic removal / addition of constraints
14/25
24. Conclusion and future work
n Design patterns + Constraints +
Inter-class design defects
– To assess / to increase software flexibility
and understandability
n Semantics, scalability, software quality
characteristics, automation, interaction,
weights, noise, hybrid
24/25
25. Thank you for your attention
Questions?
Comments?
École des Mines de Nantes
Yann-Gaël Guéhéneuc (guehene@emn.fr)
Object Technology International Inc.
25/25 Hervé Albin-Amiot (albin@emn.fr)
Soft-Maint S.A.