Post on 24-Dec-2014
description
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 TechnologyInternational Inc., Canada Soft-Maint S.A., France
2/25
Design patterns
Constraints Inter-classdesign defects
The Ptidej tool To assess / to increase software flexibility and understandability
3/25
Summary
n An overview of software qualityn A classification of design defectsnOn inter-class design defectsn Design pattern modelingn Design defects detectionn Design defects correctionn Case studiesn Conclusion and future work
4/25
An overview of software quality
n Viewpoints– ISO/IEC 9126
• Functionality, reliability, usability, efficiency, maintainability, portability
– ISO/IEC 14598– Coupling, cohesion, method replacement…
nMaintenance = 75%n Design defects
5/25
A classification of design defects
n Intra-class / Inter-class / Behavioral
Number: 39/61 (64%)Detection–correction: 25%
Number: 13/61 (21%)Detection–correction: 8%
6/25
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
7/25
On inter-class design defects 2/2
nWanted 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 quality (flexibility and understandability)
8/25
Design pattern modeling 1/3
nMeta-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
9/25
Meta-model 2/3BasicA Example:
10/25
Informal descriptions from [Gamma et al.]
Instance of class PDelegation
Instance of class PInterface
Instance of class PClass
Instance of class PAssoc
name() Instance of class PMethod
Instance of class Pattern
Pattern, PInterface, PClass, PAssoc, PDelegation, and PMethod are classes defined in our meta-model
Translates into
Composite 3/3BasicA Example:
11/25
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
12/25
Source code 1 Source code nComposite pattern abstract model
BasicA Example: Composite 2/4
Composite pattern concrete model 1 Composite pattern concrete model n
CSP CSP
Distorted concrete models
13/25
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
14/25
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
15/25
n The Ptidej tool– Hypotheses– Design pattern abstract models– Design pattern concrete models– Inter-class design defects
• Detection• Correction
Inter-class design defects 1/5
16/25
Ptidej 2/5BasicA Example:
17/25
Ptidej 3/5BasicA Example:
18/25
Ptidej 4/5BasicA Example:
19/25
Ptidej 5/5BasicA Example:
20/25
Case studies 1/4
n Several applications being reviewed– Small test-cases– HotJava v3.0 (~90 classes)– JEdit v3.1 (~250 classes)– JHotDraw v5.1 (~155 classes)– JUnit v3.2 (~90 classes)
21/25
Case studies 2/4
22/25
Case studies 3/4
23/25
Case studies 4/4
24/25
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
25/25
Questions?
Comments?
Thank you for your attention
Yann-Gaël Guéhéneuc (guehene@emn.fr)Hervé Albin-Amiot (albin@emn.fr)
Object Technology International Inc.
Soft-Maint S.A.
École des Mines de Nantes