Upload
ahmed-mohamed
View
103
Download
0
Tags:
Embed Size (px)
Citation preview
Lessons Learned in Lessons Learned in Applying Formal Concept Analysis Applying Formal Concept Analysis
to Reverse Engineeringto Reverse Engineering
Gabriela B. ArévaloGabriela B. Arévalo, St, Stéphane Ducasse, Oscar Nierstraszéphane Ducasse, Oscar NierstraszSoftware Composition GroupSoftware Composition Group
University of Bern, SwitzerlandUniversity of Bern, Switzerlandhttp://www.iam.unibe.ch/~scghttp://www.iam.unibe.ch/~scg
Abstract Z
B C
D
P
CZ
D B
P
University of Bern 2/19Gabriela B. Arévalo
RoadmapRoadmap
Motivation: Dependencies in Software SystemsMotivation: Dependencies in Software Systems
High-Level Views based on FCAHigh-Level Views based on FCA
Our Methodology and Issues to apply itOur Methodology and Issues to apply it
High-Level Views and IssuesHigh-Level Views and Issues
Lessons Learned and ConclusionsLessons Learned and Conclusions
University of Bern 3/19Gabriela B. Arévalo
Maintenance of Software SystemsMaintenance of Software Systems
Software System: Laws of Continuing Change and Increasing Complexity
Maintenance of software systems
50% to 75 % of the total cost
Reading and Analysis of Software:
½ time of maintenance phase
We need to detect Implicit Contracts between software components in a system
50% - 75 %
50%
University of Bern 4/19Gabriela B. Arévalo
Dependencies in Object Oriented SystemsDependencies in Object Oriented Systems
Software System seen as a puzzleSoftware System seen as a puzzle
Reuse
Data Encapsulation
Delegation
Dynamic Binding
Inheritance
Polymorphism
Appear several times
Do not appear isolated
Can appear at different abstraction levels
Dependency is the Dependency is the glueglue between the objects between the objects
University of Bern 5/19Gabriela B. Arévalo
High-Level Views based on Formal High-Level Views based on Formal Concept Analysis (FCA)Concept Analysis (FCA)
P
C
Z
D B
Formal Concept Analysis as a
base tool
High Level Views
Abstract Z
B C
D
P
Object Oriented Systems
University of Bern 6/19Gabriela B. Arévalo
Our MethodologyOur Methodology
<
Source Code
Magnitude Integer
Inheritance
Model Import
Source code model
Magnitude isAbstract
<self send = ….. >
FCA Mapping
Elements and Properties
ConAn Engine
Concept Lattice
Post-Filtering
Meaningful Concepts
= = =
Magnitude
<=
Analysis
High Level Views
Modelling
Interpretation
University of Bern 7/19Gabriela B. Arévalo
High Level ViewsHigh Level Views
Abstract Z
B C
Abstract Z
D
B C
P
XRay Views: Class Level
Hierarchy Schemas: Class Hierarchy Level
Collaboration Patterns: Application Level
Abstract Z
University of Bern 8/19Gabriela B. Arévalo
FCA MappingFCA Mapping
Choice of ElementsChoice of Elements
Compact Representation of DataCompact Representation of Data
Choice of PropertiesChoice of Properties
Use of Negative PropertiesUse of Negative Properties
Single or Multiple ContextsSingle or Multiple Contexts
Computation of Properties and Computation of Properties and ElementsElements
Source code model
Elements and Properties
University of Bern 9/19Gabriela B. Arévalo
ConAn EngineConAn Engine
Performance of Ganter algorithmPerformance of Ganter algorithm
Performance of Lattice Building Performance of Lattice Building AlgorithmAlgorithm
Unnecessary propertiesUnnecessary properties
Post-FilteringPost-Filtering
Removal of Top and Bottom ConceptsRemoval of Top and Bottom Concepts
Removal of Meaningless ConceptsRemoval of Meaningless Concepts
Elements and Properties
Concept Lattice
Concept Lattice
Meaningful Concepts
University of Bern 10/19Gabriela B. Arévalo
AnalysisAnalysis
Concept Interpretation based on Concept Interpretation based on Elements and PropertiesElements and Properties
Equivalent ConceptsEquivalent Concepts
Automated Concept InterpretationAutomated Concept Interpretation
Use of Partial Order in the LatticeUse of Partial Order in the Lattice
Limit of using FCA as a grouping Limit of using FCA as a grouping techniquetechnique
Meaningful concepts
High Level Views
University of Bern 11/19Gabriela B. Arévalo
XRay Views on ClassesXRay Views on Classes
“XRay Views” is a set of collaborations to show patterns based on state and behavior
usesuses aa bb cc dd ee
m1()m1() xx xx xx
m2()m2() xx xx xx
m3()m3() xx xx
m4()m4() xx
m5()m5() xx
m6()m6() xx xx
Properties: Access to instance variables
Ele
me
nts
: m
eth
od
sAbstract Z
Class A
a, b, c, d, e
m1() { .. a .. b .. d }m2() { .. a .. b .. e }
Bottom
Top
(m1,m2),
(a,b)
(m1,m3,m6), (d)
(m1), (a,b,d)
University of Bern 12/19Gabriela B. Arévalo
Issues on X-Ray ViewsIssues on X-Ray Views Compact Representation of DataCompact Representation of Data
m {…m {… self n; self n; self n }self n }
Multiple FCA Contexts: Use of State and BehaviorMultiple FCA Contexts: Use of State and Behavior
Unnecessary Properties: Unnecessary Properties: isAbstract, isAbstract, isStateless, isInterfaceisStateless, isInterface
Meaningless ConceptsMeaningless ConceptsMethods: {m,n,p,q}Methods: {m,n,p,q}Concept: {m} {n,p,q}Concept: {m} {n,p,q}
University of Bern 13/19Gabriela B. Arévalo
Schemas on Class HierarchiesSchemas on Class Hierarchies
selfself supersuper ancestorancestor locallocal descendantdescendant
m1m1 xx xx
m2m2 xx xx xx
m3m3 xx xx xx
m4m4 xx xx xx
Type of calls – Definer Class
invo
cati
on
s
B Cm1 { ... }m2 { ... }... { self m1 }... { super m3 }
m1 { ... }m4 { ... }... { self m1 }... { self m4 }... { super m3 }
Am3 { .... }
m2 {<abstract>}
m4 {<abstract>}
Analysis of Class Hierarchies based on state and behavior of a class to identify common, bad smell and irregularity design decisions
University of Bern 14/19Gabriela B. Arévalo
Issues on SchemasIssues on Schemas
Single ContextSingle ContextCompact Representation of Data:Compact Representation of Data:
Class CClass Cm { ..... self p ....} m { ..... self p ....} n { ... self p ... }n { ... self p ... }
Use of negative Properties: Use of negative Properties: no-local, no-local, no-ancestor, no-descendantno-ancestor, no-descendantMeaningless Concepts:Meaningless Concepts:
Concept: { m, n, p, q } { local }Concept: { m, n, p, q } { local }Concept: { b, c , d } { no-ancestor }Concept: { b, c , d } { no-ancestor }
University of Bern 15/19Gabriela B. Arévalo
(1,2)(1,2)SubSub (3,2)(3,2)SubSub (1,2)(1,2)AccAcc (3,2)(3,2)AccAcc (2)(2)AbsAbs
(C,A,P)(C,A,P) xx xx xx xx
(C,A,B)(C,A,B) xx xx xx xx
(Z,X,P)(Z,X,P) xx xx xx
(Z,X,Y)(Z,X,Y) xx xx xx xx
Ele
me
nts
:
Tu
ple
s o
f cl
asse
s
Properties: Relationships between classes
1 3
(1,2)Subclass
(3,2)Subclass
(2)Abstract
(3,2)Accesses
2
C P
A
Z Y
X
,=
A
C P
2
1 3
Collaboration Patterns on Collaboration Patterns on Object-Oriented ApplicationsObject-Oriented Applications
University of Bern 16/19Gabriela B. Arévalo
Issues on Collaboration PatternsIssues on Collaboration Patterns
Choice of Elements and Properties:Choice of Elements and Properties:(C A P) (1,2)(C A P) (1,2)subclasssubclass (1,3) (1,3)accessaccess
Compact Representation of Data:Compact Representation of Data:(C A P) (P C A) (P C A)(C A P) (P C A) (P C A)
Meaningless Concepts:Meaningless Concepts:(C A B) (Z X P) (1,2)(C A B) (Z X P) (1,2)subclasssubclass (2,1) (2,1)accessaccess
Mapping Partial Order of the Lattice: Mapping Partial Order of the Lattice:
A
B C
A
B C
A
B C
Almost Pattern
X
Y Z
Overloaded Pattern
Subconcept Concept Superconcept
University of Bern 17/19Gabriela B. Arévalo
FCA is a useful technique FCA is a useful technique in Reverse Engineering …in Reverse Engineering …
Lack of a general methodologyLack of a general methodology
Modelling software entities as FCA Modelling software entities as FCA componentscomponents
Performance of FCA algorithmsPerformance of FCA algorithms
Supporting Software EngineersSupporting Software Engineers
Interpretation of the ConceptsInterpretation of the Concepts
Use of the Complete LatticeUse of the Complete Lattice
Use of the Partial OrderUse of the Partial Order
University of Bern 18/19Gabriela B. Arévalo
A successful application of FCA ….A successful application of FCA ….
High-level ViewsHigh-level Views: XRay Views, Hierarchy : XRay Views, Hierarchy
Schemas, Collaboration PatternsSchemas, Collaboration Patterns
Development of a methodology Development of a methodology
Tool support of the Methodology: ConAnTool support of the Methodology: ConAn
Analysis of advantages and constraintsAnalysis of advantages and constraints
Interpretation without any mathematical Interpretation without any mathematical
knowlegeknowlege
University of Bern 19/19Gabriela B. Arévalo
Thank you !!Thank you !!
P
C
Z
D B
Abstract Z
B C
Abstract Z
D
B C
P
Abstract Z
Questions ?Questions ?