Title: Design Pattern Recovery in ObjectOriented Software
1Design Pattern Recovery in Object-Oriented
Software
- G. Antoniol, R. Fiutem and L. Cristoforetti
- In 6th International Workshop on Program
Comprehension, 1998 - 2002. 1. 28
- Presented by Jeon, Sanguk
2Contents
- Introduction
- Overview
- Recovery process
- Experimental results
- Conclusion
3Introduction(1/2)
- OO design patterns
- Represent well-known solutions to common design
problems in a given context - Give some indications to managers about the
quality of the system - Modularity, separation of concerns,
maintainability
4Introduction(2/2)
- Discovery of patterns in software
- Helps in understanding a piece of design or code
- Knowledge about the role of each class within the
pattern - The reason of certain relationship among pattern
constituents and/or the remaining parts - This paper presents
- A conservative approach to extract structural
design patterns from OO design or code
5Overview
6Recovery Process
- AOL Representation Extraction
- AOL Representation Parsing
- Class Metrics Extraction
- Pattern Recognition
7Process 1. AOL Representation
CLASS Target OPERATIONS
PUBLIC Request() CLASS
Adapter OPERATIONS
PUBLIC Request() CLASS Adaptee
OPERATIONS
PUBLIC SpecificRequest() GENERALIZATION
Target SUBCLASSES Adapter RELATION
Delegates ROLES
CLASS Adapter MULT One,
CLASS Adaptee MULT One
Client
Target
Request()
Adapter
Request()
Adaptee
Adaptee
SpecificRequest()
Adaptee-gtSpeificRequest()
8Process - 2. Class Metrics Extraction
- Class level metrics
- Number of public, private, protected attribute
- Number of public, private, protected operations
- Number of associations, aggregations,
inheritance(or generalization) relationships in
which a class is involved
9Process 3. Pattern Recognition(1/6)
- Identify a set of classes which exhibits the
exact relationships - Aggregations, associations, inheritances
- Brute force approach
- Identify all possible pattern candidates
- Combinatorial explosion
- Reduction is needed
- Metrics constraint evaluation
- Structural and delegation constraints evaluation
10Process 3. Pattern Recognition(2/6)
- Metrics Constraint Evaluation
- Find candidate classes for a pattern element
Pattern element
Class Q M1 ? a M2 ? b M3 ? c
Candidate All values are equal to or greater
than those of class P
Class P M1 a M2 b M3 c
Class R M1 ? a M2 lt b M3 lt c
11Process 3. Pattern Recognition(3/6)
- Metrics Constraint Evaluation(cont)
- Find one candidate set with minimum number of
elements
Set C2 Class D Class E Class F Class G
Set C1 Class A Class B Class D
Set C3 Class A Class G
Set C4 Class I Class J Class K
Set C3 Class A Class G
12Process 3. Pattern Recognition(4/6)
- Metrics Constraint Evaluation(cont)
- Find candidates whose shortest paths to each
other are same with pattern
Pattern
Candidate
Class P
Class R
Class A
Class C
Shortest Path a
Shortest Path a
Shortest Path b
Shortest Path b
Class Q
Class B
13Process 3. Pattern Recognition(5/6)
- Structural Constraint Evaluation
- Check the relationships
Pattern
Candidate
Class P
Class R
Class A
Class C
Class Q
Class B
14Process 3. Pattern Recognition(6/6)
- Delegation Constraint Evaluation
- Verify that a given method of a class actually
calls a method of another class - Information is extracted from code
15Experimental Results(1/4)
- Public domain code
- Reduction of candidates through the stage filters
16Experimental Results(2/4)
- Public domain code
- Results of recovery on code
17Experimental Results(3/4)
- Industrial code
- Characteristics
18Experimental Results(4/4)
Result on Design
Result on Code
19Conclusion
- This paper presented
- An approach to extract design pattern from OO
design or code - Reduction of search space complexity
- Software metrics
- Structural and delegation information