250 likes | 379 Views
Detecting Implicit Collaboration Patterns. Gabriela Ar évalo, Frank Buchli, Oscar Nierstrasz Software Composition Group University of Bern – Switzerland http://www.iam.unibe.ch/~scg. Roadmap. Motivation General Approach Formal Concept Analysis in a Nutshell
E N D
Detecting Implicit Collaboration Patterns Gabriela Arévalo, Frank Buchli, Oscar Nierstrasz Software Composition Group University of Bern – Switzerland http://www.iam.unibe.ch/~scg WCRE ’04 – Delft – The Netherlands
Roadmap • Motivation • General Approach • Formal Concept Analysis in a Nutshell • FCA in detecting Collaboration Patterns • Validation: Case Studies & Results • Conclusions & Future Work WCRE ’04 – Delft – The Netherlands
Motivation: 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 WCRE ’04 – Delft – The Netherlands
Our Approach WCRE ’04 – Delft – The Netherlands
{Arie, Gaby}, {Static, Patterns} {Gaby}, {Static, FCA, Patterns} {Arie}, {Static, Aspect, Patterns, FanIn} Formal Concept Analysis in a Nutshell 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 WCRE ’04 – Delft – The Netherlands
FCA Mapping: Elements & Properties • Elements: • Tuples of classes • Number of classes: order • Properties: • Unary Relations: isAbstract, isRoot, isSingleton, hasLocalMethodDefined • Binary Relations: isSubclass, accesses, hasAsAttribute, invokes, usesLocally A C P Element: (C A P) { C isSubclass A, P isSubclass A, P invokes A, A isAbstract } WCRE ’04 – Delft – The Netherlands
FCA Mapping: Incidence Table 2 A 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 WCRE ’04 – Delft – The Netherlands
2 2 (1,2)Subclass (2)Abstract (1,2)Accesses (1,2)Subclass (2)Abstract (1,2)Accesses X X Z Z Y Y 1 1 3 3 Post-Filtering (I) 2 A C P Tuples of classes 1 3 (1,2)Subclass (3,2)Subclass (2)Abstract (3,2)Accesses • Remove unconnected patterns WCRE ’04 – Delft – The Netherlands
Post-Filtering (II) • Merging Equivalent Patterns S (T U S) (1,3)Sub (2,1)Acc D 3 1 (D E F) (2,1)Sub (3,2)Acc 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) WCRE ’04 – Delft – The Netherlands
Validation: Case Studies • ADvance: multidimensional OOAD-tool (www.io.com/~icc) • CodeCrawler: language independent software visualization tool (www.iam.unibe.ch/~scg) WCRE ’04 – Delft – The Netherlands
A A A A Selected 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 WCRE ’04 – Delft – The Netherlands
Statistics about Detected Patterns WCRE ’04 – Delft – The Netherlands
Evaluation 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 WCRE ’04 – Delft – The Netherlands
Conclusions • 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 WCRE ’04 – Delft – The Netherlands
Future 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 WCRE ’04 – Delft – The Netherlands
The End Questions ? P Abstract Z C B D Thank you very much !!! WCRE ’04 – Delft – The Netherlands
Problem: Example Abstract X P I K J Z Y Abstract A T F C B H G D WCRE ’04 – Delft – The Netherlands
Comparison • 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 WCRE ’04 – Delft – The Netherlands
Performance of the Algorithm Based on a small experiment of 7 classes WCRE ’04 – Delft – The Netherlands
Pattern Neighbourhood (1/2) Almost Pattern X A Y Z B C A O=3 B C A B C Overloaded Pattern WCRE ’04 – Delft – The Netherlands
Pattern Neighbourhood (2/2) Cover Pattern D A O=4 B C O=3 A B C O=2 A A B C Sub Pattern WCRE ’04 – Delft – The Netherlands
Lessons 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 WCRE ’04 – Delft – The Netherlands
Goals • 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 WCRE ’04 – Delft – The Netherlands
{Kim, Andy, Markus}, {Jazz} {Kim, Andy}, {Rock, Jazz} {Markus}, {Jazz, Pop, Rap} Formal Concept Analysis in a Nutshell 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 WCRE ’04 – Delft – The Netherlands