This document discusses applying formal concept analysis (FCA) to reverse engineering software systems. It presents three key high-level views that can be generated from FCA: 1) XRay views that show class-level patterns of state and behavior; 2) hierarchy schemas that analyze class hierarchies; and 3) collaboration patterns that identify relationships between classes. The document also discusses several issues that arose in applying FCA, such as choosing the right elements and properties to model, dealing with meaningless concepts, and interpreting concept lattices. It concludes that FCA is useful for reverse engineering but lacks a general methodology and tool support to help software engineers interpret results.
1. Lessons Learned in
Applying Formal Concept Analysis
to Reverse Engineering
P
P
Abstract Z
Z
C
D
B
B
C
D
Gabriela B. Arévalo, Stéphane Ducasse, Oscar Nierstrasz
Software Composition Group
University of Bern, Switzerland
http://www.iam.unibe.ch/~scg
2. Roadmap
Motivation: Dependencies in Software Systems
High-Level Views based on FCA
Our Methodology and Issues to apply it
High-Level Views and Issues
Lessons Learned and Conclusions
University of Bern Gabriela B. Arévalo
2/19
3. Maintenance of Software Systems
Software System: Laws of Continuing Change
and Increasing Complexity
Maintenance of software systems
50% to 75 % of the total cost
50% - 75 %
Reading and Analysis of Software:
½ time of maintenance phase
50%
We need to detect Implicit Contracts between
software components in a system
University of Bern Gabriela B. Arévalo
3/19
4. Dependencies in Object Oriented Systems
Software System seen as a puzzle
Polymorphism
Delegation
Dynamic
Binding
Reuse
Data
Encapsulation
Inheritance
Dependency is the glue between the objects
Appear several times
Do not appear isolated
Can appear at different abstraction levels
University of Bern Gabriela B. Arévalo
4/19
5. High-Level Views based on Formal
Concept Analysis (FCA)
Object Oriented
Systems
P
Formal Concept
Analysis as a
base tool
High Level Views
P
Abstract Z
Z
C
D
B
C
B
D
University of Bern Gabriela B. Arévalo
5/19
6. Our Methodology
Magnitude
<
=
<
High Level Views
Interpretation
Analysis
=
=
=
Meaningful Concepts
Post-Filtering
Concept Lattice
ConAn Engine
Magnitude isAbstract
Modelling
<self send = ….. >
Elements and Properties
FCA Mapping
Magnitude
Integer
Source code model
Inheritance
Model Import
Source
Code
University of Bern Gabriela B. Arévalo
6/19
7. High Level Views
Abstract Z
XRay Views:
Class Level
Abstract Z
Hierarchy Schemas:
Class Hierarchy Level
B
C
P
Collaboration Patterns:
Application Level
Abstract Z
B
C
D
University of Bern Gabriela B. Arévalo
7/19
8. Elements and Properties
FCA Mapping
Source code model
Choice of Elements
Compact Representation of Data
Choice of Properties
Use of Negative Properties
Single or Multiple Contexts
Computation of Properties and
Elements
University of Bern Gabriela B. Arévalo
8/19
9. Concept Lattice
ConAn Engine
Elements and Properties
Performance of Ganter algorithm
Performance of Lattice Building
Algorithm
Unnecessary properties
Meaningful Concepts
Post-Filtering
Concept Lattice
Removal of Top and Bottom Concepts
Removal of Meaningless Concepts
University of Bern Gabriela B. Arévalo
9/19
10. High Level Views
Analysis
Meaningful concepts
Concept Interpretation based on
Elements and Properties
Equivalent Concepts
Automated Concept Interpretation
Use of Partial Order in the Lattice
Limit of using FCA as a grouping
technique
University of Bern Gabriela B. Arévalo
10/19
11. Abstract Z
XRay Views on Classes
Properties: Access to instance variables
a
b
m1()
Elements:
methods
uses
x
x
m2()
x
c
d
x
Top
e
x
x
m3()
x
m4()
x
m5()
x
m6()
x
(m1,m3,m6),
(d)
(m1,m2),
(a,b)
x
(m1),
(a,b,d)
Bottom
x
Class A
“XRay Views” is a set of
collaborations to show
patterns based on state and
behavior
a, b, c, d, e
m1() { .. a .. b .. d }
m2() { .. a .. b .. e }
University of Bern Gabriela B. Arévalo
11/19
12. Issues on X-Ray Views
Compact Representation of Data
m {…
self n;
self n }
Multiple FCA Contexts: Use of State and Behavior
Unnecessary Properties: isAbstract,
isStateless, isInterface
Meaningless Concepts
Methods: {m,n,p,q}
Concept: {m} {n,p,q}
University of Bern Gabriela B. Arévalo
12/19
13. Schemas on Class Hierarchies
Type of calls – Definer Class
invocations
self
m1
super
local
x
x
m3
x
x
descendant
A
x
m2
m4
ancestor
x
x
Analysis of Class Hierarchies
based on state and behavior
of a class to identify common,
bad smell and irregularity
design decisions
x
m3 { .... }
x
x
m2
{<abstract>}
x
m4
{<abstract>}
C
B
m1 { ... }
m2 { ... }
... { self m1 }
... { super m3 }
University of Bern Gabriela B. Arévalo
m1 { ... }
m4 { ... }
... { self m1 }
... { self m4 }
... { super m3 }
13/19
14. Issues on Schemas
Single Context
Compact Representation of Data:
Class C
m { ..... self p ....}
n { ... self p ... }
Use of negative Properties: no-local,
no-ancestor, no-descendant
Meaningless Concepts:
Concept: { m, n, p, q } { local }
Concept: { b, c , d } { no-ancestor }
University of Bern Gabriela B. Arévalo
14/19
15. Collaboration Patterns on
Object-Oriented Applications
Properties: Relationships between classes
Tuples of classes
Elements:
(1,2)Sub
(3,2)Sub
(C,A,P)
x
x
(C,A,B)
x
x
(Z,X,P)
x
(Z,X,Y)
x
(3,2)Acc
x
2
A
x
x
x
x
C
P
x
1
3
x
(3,2) Subclass
3
(2)Abs
x
x
(1,2) Subclass
2
1
(1,2)Acc
(2) Abstract
A
=
C
X
P
,
Z
(3,2) Accesses
University of Bern Gabriela B. Arévalo
15/19
Y
16. Issues on Collaboration Patterns
Choice of Elements and Properties:
(C A P) (1,2)subclass (1,3)access
Compact Representation of Data:
(C A P) (P C A) (P C A)
Meaningless Concepts:
(C A B) (Z X P) (1,2)subclass (2,1)access
Mapping Partial Order of the Lattice:
Subconcept
Concept
A
B
Superconcept
A
C
Overloaded Pattern
B
X
C
University of Bern Gabriela B. Arévalo
Y
A
Z
B
Almost Pattern
16/19
C
17. FCA is a useful technique
in Reverse Engineering …
Lack of a general methodology
Modelling software entities as FCA
components
Performance of FCA algorithms
Supporting Software Engineers
Interpretation of the Concepts
Use of the Complete Lattice
Use of the Partial Order
University of Bern Gabriela B. Arévalo
17/19
18. A successful application of FCA ….
High-level Views: XRay Views, Hierarchy
Schemas, Collaboration Patterns
Development of a methodology
Tool support of the Methodology: ConAn
Analysis of advantages and constraints
Interpretation without any mathematical
knowlege
University of Bern Gabriela B. Arévalo
18/19
19. Thank you !!
Abstract Z
Abstract Z
P
Z
B
C
C
D
B
P
Abstract Z
B
C
D
Questions ?
University of Bern Gabriela B. Arévalo
19/19
Editor's Notes
After the title, I should say what the work is about
Atencion !! I work with Oscar and Stef