Title: Detecting Implicit Collaboration Patterns
1Detecting Implicit Collaboration Patterns
- Gabriela Arévalo, Frank Buchli, Oscar Nierstrasz
- Software Composition Group
- University of Bern Switzerland
- http//www.iam.unibe.ch/scg
2Roadmap
- Motivation
- General Approach
- Formal Concept Analysis in a Nutshell
- FCA in detecting Collaboration Patterns
- Validation Case Studies Results
- Conclusions Future Work
3Motivation Pattern Mining
- Pattern is a recurring set of properties
(structural relationships) that characterize a
set of classes. - design patterns, architectural constraints,
idioms and conventions adopted in the system. - Detecting implicit contracts is not trivial
- The documentation is out-of-date
- The information is not explicit in the code
4Our Approach
5Formal Concept Analysis in a Nutshell
Aspect Patterns FCA FanIn Static Dynamic
Mariano True True True
Arie True True True True
Gaby True True True
Top
- Concept Maximal group of elements based on
their common properties, and maximal group of
properties based on their elements. - Lattice partial order over the concepts
Bottom
6FCA Mapping Elements Properties
A
- Elements
- Tuples of classes
- Number of classes order
- Properties
- Unary Relations isAbstract,
- isRoot, isSingleton, hasLocalMethodDefined
- Binary Relations isSubclass, accesses,
hasAsAttribute, invokes, usesLocally
C
P
Element (C A P) C isSubclass A, P isSubclass
A, P invokes A, A isAbstract
7FCA Mapping Incidence Table
2
A
(1,2)Sub (3,2)Sub (1,2)Acc (3,2)Inv (2)Abs
(C A P) True True True True
(C A B) True True True True
(Z X Y) True True True
(Z X P) True True True True
C
P
Tuples of classes
1
3
Element (C A P) 1 isSubclass 2, 3 isSubclass
2, 3 invokes 2, 2 isAbstract (1,2)Sub
(3,2)Sub (3,2)Inv (2)Abs
A B C P X Y Z all classes in a system
Properties Set of indexes to show relationships
in the tuples. (i,j)relation and (i)feature
8Post-Filtering (I)
2
(1,2)Sub (3,2)Sub (1,2)Acc (3,2)Inv (2)Abs
(C A P) True True True True
(C A B) True True True True
(Z X Y) True True True
(Z X P) True True True True
A
C
P
Tuples of classes
1
3
(1,2)Subclass (3,2)Subclass (2)Abstract (3,2)Acces
ses
- Remove unconnected patterns
9Post-Filtering (II)
- Merging Equivalent Patterns
S
(T U S) (1,3)Sub (2,1)Acc
D
3
(D E F) (2,1)Sub (3,2)Acc
1
E
F
T
U
2
1
3
2
Permutation of indexes ? 1 ? 2, 2 ? 3, 3 ?
1 ?((1,3)Sub (2,1)Acc)) ((2,1)Sub (3,2)Acc))
(T,U,S) is transformed in (S,T,U)
10Validation Case Studies
- ADvance multidimensional OOAD-tool
(www.io.com/icc) - CodeCrawler language independent software
visualization tool (www.iam.unibe.ch/scg)
11Selected Collaboration Patterns
Attribute Star
Attribute Chain
A
Order 3
A
Order 3
Order 4
Order 4
Composite
Bridge
A
A
Order 3
Order 4
Order 3
Order 4
12Statistics about Detected Patterns
13Evaluation of Results
- Classes as Center of Systems
- CodeCrawler CCTool is in none of patterns
- CCNodePlugin is in 47 patterns up to order 4
- Identify candidates of design patterns
- Façade, Adapter and Bridge
- Coding Styles frequency of some patterns
- CodeCrawler heavy use of Subclass Star and
Façade - Advance Composite
14Conclusions
- Development of an approach that detect unknown
recurring patterns - Collaboration Patterns cover more than Design
Patterns - Incremental pattern library
- FCA used as a metatool
- FCA is an exciting tool but
- Critical issue Choice of Properties
- Performance of the algorithm
- Filters
15Future Work
- Incremental Concept Analysis with combination of
Iceberg idea. - Use higher abstraction level information
(isLeaf, isComponent, isFacade) - Solve the scalability problem
- Better name guessing less restrictive
interpretation - Use different orders of tuples in the same lattice
16The End
P
Abstract Z
B
C
D
Thank you very much !!!
17(No Transcript)
18Problem Example
Abstract X
P
I
J
K
Z
Y
Abstract A
T
F
C
B
H
G
D
19Comparison
- Refinement and extension of Tonella and Antoniol
approach to detect classical design patterns - Similarities
- Source code of an object oriented application
- Extract structural relationships between classes
- Differences
- Improvements to avoid redundancy in the
information - Improvements the time performance
- Generalize the technique to a language
independent approach - Introduction of a filtering phase to narrow the
scope of candidate patterns
20Performance of the Algorithm
- Based on a small experiment of 7 classes
21Pattern Neighbourhood (1/2)
Almost Pattern
A
X
B
C
Y
Z
A
O3
B
C
A
B
C
Overloaded Pattern
22Pattern Neighbourhood (2/2)
Cover Pattern
A
D
O4
B
C
A
O3
B
C
O2
A
A
B
C
Sub Pattern
23Lessons Learned
- Lack of a general methodology
- Modelling software entities as FCA components is
not a trivial task - Performance of the algorithms
- Supporting End-Users ConAn PaDi
- Interpretation of the concepts
- Use of Complete Lattice
- Use of the Partial Order
24Goals
- Detection of classical and non-classical patterns
- DEFINIR QUE ES UN PATTERN
- Establish relationships over detected patterns
pattern neighbourhoods - Missing relationships between classes to complete
a pattern - Excess relationships between classes that extend
a pattern - Incremental construction of a pattern library
- Analysis of advantages and drawbacks of using FCA
in this approach
25Formal Concept Analysis in a Nutshell
Rock Jazz Pop Blues Rap
Kim True True
Andy True True
Stef True True
Markus True True True
Orla True True
Gaby True True
Top
- Incidence Table relationships between elements
and properties. - Concept Maximal groups of elements based on
their common properties, and maximal groups of
properties based on their elements. - Lattice partial order over the concepts
Bottom