RMoD
Friday, June 17, 2011 / 65
Package DependenciesAnalysis and Remediation
in Object-Oriented Systems
Jannik Laval
1
Friday, June 17, 2011 / 65
Package Maintenance
‣ Big software applications
• Pharo (+100 packages), Moose (+100 packages),
• Eclipse (+250 packages)
‣ Complexity grows with evolution
‣ Maintenance and evolution may take more than 60% of the overall budget
• => Difficulties to maintain
2
Friday, June 17, 2011 / 65
(Re)modularization
• Improving the package structure
• to support evolution
i. Understanding the structure
ii. Understanding the structural problems
iii. Taking decisions for restructuring
3
Friday, June 17, 2011 / 65
Package Granularity‣ Reuse and release unit
4
Friday, June 17, 2011 / 65
Package Granularity‣ Reuse and release unit
‣ Group of classes
• > Complex entity
4
Friday, June 17, 2011 / 65
Package Granularity‣ Reuse and release unit
‣ Group of classes
• > Complex entity
‣ Multiple dependencies
• > Inheritance, invocation, reference, extension
4
Package A
Package B
A1
A3
A2
A5A4
B1 B2
B3
Other package
Other package
Friday, June 17, 2011 / 65
Package Granularity‣ Reuse and release unit
‣ Group of classes
• > Complex entity
‣ Multiple dependencies
• > Inheritance, invocation, reference, extension
‣ Different organizations of the system [Abreu 2001]
• > Feature containment
• > Deployment unit
• > Team organization
4
Package A
Package B
A1
A3
A2
A5A4
B1 B2
B3
Other package
Other package
A2
B2
A1
B1
C1
D1
P1
A3
C2
D2
P4(a)
A1
B1
C1
D1
P1 P2 P3
A2
B2
A3
C2
D2
P4(c)
Friday, June 17, 2011 / 65
Package Modularity is Crucial‣ A good package organization ease the evolution of the
system. [De Remer 1976, Myers 1978, Yourdon 1979, Pressman 1994, Ponisio 2006]
5
Friday, June 17, 2011 / 65
Package Modularity is Crucial‣ A good package organization ease the evolution of the
system. [De Remer 1976, Myers 1978, Yourdon 1979, Pressman 1994, Ponisio 2006]
‣ Acyclic Dependency Principle:
• “The dependencies between packages must not form cycles” [Martin 1996, 2000]
5
Friday, June 17, 2011 / 65
Package Modularity is Crucial‣ A good package organization ease the evolution of the
system. [De Remer 1976, Myers 1978, Yourdon 1979, Pressman 1994, Ponisio 2006]
‣ Acyclic Dependency Principle:
• “The dependencies between packages must not form cycles” [Martin 1996, 2000]
‣ Packages should form a layered structure [Bachmann, 2000; Demeyer, 2002]
5
pC
pA pB
pD pELayer A
Layer B
KernelLayer C
Friday, June 17, 2011 / 65
Package Modularity is Crucial‣ A good package organization ease the evolution of the
system. [De Remer 1976, Myers 1978, Yourdon 1979, Pressman 1994, Ponisio 2006]
‣ Acyclic Dependency Principle:
• “The dependencies between packages must not form cycles” [Martin 1996, 2000]
‣ Packages should form a layered structure [Bachmann, 2000; Demeyer, 2002]
• => Undesired cycles should be removed
5
pC
pA pB
pD pELayer A
Layer B
KernelLayer C
Friday, June 17, 2011 / 65
Cyclic dependency problem
• [Martin 2002: Agile Software Development, Principles, Patterns, and Practices]
6
A
B
E
D
C
Change
Possible Impact
Modifying a package impacts the dependent packages.
Friday, June 17, 2011 / 65
Cyclic dependency problem
• [Martin 2002: Agile Software Development, Principles, Patterns, and Practices]
6
A
B
E
D
C
Change
Possible Impact
Modifying a package impacts the dependent packages.
Friday, June 17, 2011 / 65
Cyclic dependency problem
• [Martin 2002: Agile Software Development, Principles, Patterns, and Practices]
6
A
B
E
D
C
Change
Possible Impact
Modifying a package impacts the dependent packages.
Friday, June 17, 2011 / 65
Cyclic dependency problem
• [Martin 2002: Agile Software Development, Principles, Patterns, and Practices]
7
A
B
E
D
C
Modifying a package impacts the dependent packages.
Change
Possible Impact
Friday, June 17, 2011 / 65
Cyclic dependency problem
• [Martin 2002: Agile Software Development, Principles, Patterns, and Practices]
7
A
B
E
D
C
Modifying a package impacts the dependent packages.
Change
Possible Impact
Friday, June 17, 2011 / 65
Cyclic dependency problem
• [Martin 2002: Agile Software Development, Principles, Patterns, and Practices]
7
A
B
E
D
C
Modifying a package impacts the dependent packages.
Change
Possible Impact
Friday, June 17, 2011 / 65
Cyclic dependency problem
• [Martin 2002: Agile Software Development, Principles, Patterns, and Practices]
7
A
B
E
D
C
Modifying a package impacts the dependent packages.
Change
Possible Impact
Friday, June 17, 2011 / 65
Thesis
• In large software architectures, we need to identify dependencies between packages causing structural problems and help proposing solutions to
avoid problems for modularity.
8
Friday, June 17, 2011 / 65
Challenges
‣ Identifying cycles between packages
9
Friday, June 17, 2011 / 65
Challenges
‣ Identifying cycles between packages
‣ Selecting unwanted dependencies
9
Friday, June 17, 2011 / 65
Challenges
‣ Identifying cycles between packages
‣ Selecting unwanted dependencies
‣ Assessing changes at structural level
•
9
Friday, June 17, 2011 / 65
eCOO: Paradigm
10
• Package Cycle Remediation
source code
model
Friday, June 17, 2011 / 65
eCOO: Paradigm
10
• Package Cycle Remediation
identifying cycles
source code
model
Friday, June 17, 2011 / 65
eCOO: Paradigm
10
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependenciessource code
model
Friday, June 17, 2011 / 65
eCOO: Paradigm
10
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
Friday, June 17, 2011 / 65
eCOO: Paradigm
10
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
Friday, June 17, 2011 / 65
eCOO: Contribution
11
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
modeleCOO
Friday, June 17, 2011 / 65
eCOO: Contribution
11
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSM
eCOO
Friday, June 17, 2011 / 65
eCOO: Contribution
11
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
eCOO
Friday, June 17, 2011 / 65
eCOO: Contribution
11
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
eCOO
Friday, June 17, 2011 / 65
eCOO: Contribution
11
• Package Cycle Remediation
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
Contribution: eDSM
12
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
Identifying cyclic dependencies?
13
PA
A1
PB
B1
PC
C1
PD
D1
PE
E1
A2
B2
D2
E2
A3
PF
F1PG
G1
PH
H1
Friday, June 17, 2011 / 65
Identifying cyclic dependencies?
13
PA
A1
PB
B1
PC
C1
PD
D1
PE
E1
A2
B2
D2
E2
A3
PF
F1PG
G1
PH
H1
i. Graph abstraction
Friday, June 17, 2011 / 65
Identifying cyclic dependencies?
13
PA
A1
PB
B1
PC
C1
PD
D1
PE
E1
A2
B2
D2
E2
A3
PF
F1PG
G1
PH
H1
i. Graph abstraction
PA
PB
PE PD
PC
PF
PH PG
Friday, June 17, 2011 / 65
Identifying cyclic dependencies?
13
PA
A1
PB
B1
PC
C1
PD
D1
PE
E1
A2
B2
D2
E2
A3
PF
F1PG
G1
PH
H1
i. Graph abstraction
ii. Strongly Connected Components(SCC) detection [Tarjan, 1972]
PA
PB
PE PD
PC
PF
PH PG
Friday, June 17, 2011 / 65
A large software application
14
‣ Graph is not scalable.
• Pharo Core 1.1, 115 packages
FixUnderscores
Tools
Collections-Strings
Collections-Sequenceable
Graphics
PackageInfo
System-Tools
Kernel
Exceptions
Collections-Unordered
Files
Collections-Arrayed
Collections-Abstract
System-Change Notification
Morphic
Compiler
Compression
ToolBuilder-Kernel
System-Support
Traits
Collections-Streams
System-Changes
Network-Protocols
Multilingual
System-Applications
Network-Url
System-FilePackage
Collections-Text
Collections-Weak
Collections-Support
ST80
System-FileRegistry
System-Clipboard
Network-RemoteDirectoryNetwork-MIME
System-LocalizationFreeType
System-Object Storage
Polymorph-Widgets
System-Platforms
Announcements
System-Object Events
System-Finalization
System-Pools
FreeTypeSubPixelAntiAliasing
Balloon
FreeTypeTests
SUnit
Monticello
Gofer-Tests
Gofer-Core Network-UUID
MonticelloMocksTests
GraphicsResources
MonticelloGUI
System-Text
MenuRegistration
Polymorph-TaskbarIcons
Morphic-Balloon
ToolBuilder-Morphic
GraphicsTests
HelpSystem-Tests
HelpSystem-Core
HelpSystem-Core-UI
HelpSystem-Core-Model
HelpSystem-Core-Utilities
KernelTests
TrueType
System-Digital Signatures
Network-Kernel
Morphic-TrueType
Network-RFC822
MorphicTests
MultilingualTests Network-MailSending
NetworkTests
Network-URI Polymorph-ToolBuilder
ScriptLoader
Settings-Compiler
Settings-Display
Settings-FreeType
Settings-Graphics
System-Settings
MonticelloConfigurations
Settings-Network
Settings-Polymorph
Polymorph-Tools-Diff
VB-Regex
Morphic-MorphTreeWidget
Settings-Kernel Settings-Monticello Settings-System
Settings-Tools
System-Hashing
System-Serial Port
Tests-Bugs
Tests-ObjectsAsMethods
Tests-PrimCallController
Tests-Release
Tests-SystemChangeNotification
Tests-VM
ToolsTest
Polymorph-GeometryPolymorph-EventEnhancements
ScriptLoader11CompilerTests
ToolBuilder-SUnit
CollectionsTests
DeprecatedPreferencesHostMenus Collections-Stack
System-Download
SUnitGUI
Friday, June 17, 2011 / 65
MonticelloMocks
Monticello
Kernel
Tests
Collections-Arrayed
Collections-Weak
System-Object Storage
System-Support
Network-UUID
Collections-Sequenceable
Collections-Text
Exceptions
System-Change Notification
Graphics
Collections-Unordered
Traits
System-Changes
Collections-Abstract
PackageInfo
Collections-Strings
Compression
Tools
Compiler
System-Tools
Files
Collections-Streams
System-FilePackage
System-Applications
ToolBuilder-Kernel
System-FileRegistry
Network-MIME
System-Pools
Network-Protocols
Network-Url
Morphic
Multilingual
Announcements
System-Object Events
Collections-Support
Polymorph-Widgets
ST80
System-Finalization
System-Clipboard
System-Platforms
VB-Regex
System-Digital Signatures
System-Text
ScriptLoader11
System-Localization
CompilerTests
SUnit
MonticelloGUI
ToolBuilder-SUnitCollectionsTests
ToolBuilder-Morphic
Balloon
MenuRegistration
Polymorph-TaskbarIcons
TrueType
Network-Kernel
FreeType
DeprecatedPreferences
MonticelloConfigurations
Gofer-Core HostMenus
Network-RemoteDirectory
Collections-Stack
Settings-Polymorph
Polymorph-Tools-Diff
System-Download
Morphic-Balloon
Polymorph-Geometry
Polymorph-EventEnhancements
SUnitGUI
Network-RFC822
FixUnderscores FreeTypeSubPixelAntiAliasing FreeTypeTests Gofer-Tests GraphicsResources GraphicsTests HelpSystem-Core-Model HelpSystem-Core
HelpSystem-Core-Utilities
HelpSystem-Core-UI
HelpSystem-Tests KernelTests Morphic-MorphTreeWidget Morphic-TrueType MorphicTests MultilingualTests Network-MailSending Network-URI NetworkTests Polymorph-ToolBuilder ScriptLoader Settings-Compiler Settings-Display Settings-FreeType Settings-Network System-Settings Settings-Graphics Settings-Kernel Settings-Monticello Settings-System Settings-Tools System-Hashing System-Serial Port Tests-Bugs Tests-ObjectsAsMethods Tests-PrimCallController Tests-Release Tests-SystemChangeNotification Tests-VM ToolsTest
Packages in SCC
15
‣ Cycles are not visible.
• Pharo Core 1.1, 78 packages in cycle
Friday, June 17, 2011 / 65
MonticelloMocks
Monticello
Kernel
Tests
Collections-Arrayed
Collections-Weak
System-Object Storage
System-Support
Network-UUID
Collections-Sequenceable
Collections-Text
Exceptions
System-Change Notification
Graphics
Collections-Unordered
Traits
System-Changes
Collections-Abstract
PackageInfo
Collections-Strings
Compression
Tools
Compiler
System-Tools
Files
Collections-Streams
System-FilePackage
System-Applications
ToolBuilder-Kernel
System-FileRegistry
Network-MIME
System-Pools
Network-Protocols
Network-Url
Morphic
Multilingual
Announcements
System-Object Events
Collections-Support
Polymorph-Widgets
ST80
System-Finalization
System-Clipboard
System-Platforms
VB-Regex
System-Digital Signatures
System-Text
ScriptLoader11
System-Localization
CompilerTests
SUnit
MonticelloGUI
ToolBuilder-SUnitCollectionsTests
ToolBuilder-Morphic
Balloon
MenuRegistration
Polymorph-TaskbarIcons
TrueType
Network-Kernel
FreeType
DeprecatedPreferences
MonticelloConfigurations
Gofer-Core HostMenus
Network-RemoteDirectory
Collections-Stack
Settings-Polymorph
Polymorph-Tools-Diff
System-Download
Morphic-Balloon
Polymorph-Geometry
Polymorph-EventEnhancements
SUnitGUI
Network-RFC822
FixUnderscores FreeTypeSubPixelAntiAliasing FreeTypeTests Gofer-Tests GraphicsResources GraphicsTests HelpSystem-Core-Model HelpSystem-Core
HelpSystem-Core-Utilities
HelpSystem-Core-UI
HelpSystem-Tests KernelTests Morphic-MorphTreeWidget Morphic-TrueType MorphicTests MultilingualTests Network-MailSending Network-URI NetworkTests Polymorph-ToolBuilder ScriptLoader Settings-Compiler Settings-Display Settings-FreeType Settings-Network System-Settings Settings-Graphics Settings-Kernel Settings-Monticello Settings-System Settings-Tools System-Hashing System-Serial Port Tests-Bugs Tests-ObjectsAsMethods Tests-PrimCallController Tests-Release Tests-SystemChangeNotification Tests-VM ToolsTest
Packages in SCC
15
‣ Cycles are not visible.
• Pharo Core 1.1, 78 packages in cycle
What are the differences between these dependencies ?
Friday, June 17, 2011 / 65
MonticelloMocks
Monticello
Kernel
Tests
Collections-Arrayed
Collections-Weak
System-Object Storage
System-Support
Network-UUID
Collections-Sequenceable
Collections-Text
Exceptions
System-Change Notification
Graphics
Collections-Unordered
Traits
System-Changes
Collections-Abstract
PackageInfo
Collections-Strings
Compression
Tools
Compiler
System-Tools
Files
Collections-Streams
System-FilePackage
System-Applications
ToolBuilder-Kernel
System-FileRegistry
Network-MIME
System-Pools
Network-Protocols
Network-Url
Morphic
Multilingual
Announcements
System-Object Events
Collections-Support
Polymorph-Widgets
ST80
System-Finalization
System-Clipboard
System-Platforms
VB-Regex
System-Digital Signatures
System-Text
ScriptLoader11
System-Localization
CompilerTests
SUnit
MonticelloGUI
ToolBuilder-SUnitCollectionsTests
ToolBuilder-Morphic
Balloon
MenuRegistration
Polymorph-TaskbarIcons
TrueType
Network-Kernel
FreeType
DeprecatedPreferences
MonticelloConfigurations
Gofer-Core HostMenus
Network-RemoteDirectory
Collections-Stack
Settings-Polymorph
Polymorph-Tools-Diff
System-Download
Morphic-Balloon
Polymorph-Geometry
Polymorph-EventEnhancements
SUnitGUI
Network-RFC822
FixUnderscores FreeTypeSubPixelAntiAliasing FreeTypeTests Gofer-Tests GraphicsResources GraphicsTests HelpSystem-Core-Model HelpSystem-Core
HelpSystem-Core-Utilities
HelpSystem-Core-UI
HelpSystem-Tests KernelTests Morphic-MorphTreeWidget Morphic-TrueType MorphicTests MultilingualTests Network-MailSending Network-URI NetworkTests Polymorph-ToolBuilder ScriptLoader Settings-Compiler Settings-Display Settings-FreeType Settings-Network System-Settings Settings-Graphics Settings-Kernel Settings-Monticello Settings-System Settings-Tools System-Hashing System-Serial Port Tests-Bugs Tests-ObjectsAsMethods Tests-PrimCallController Tests-Release Tests-SystemChangeNotification Tests-VM ToolsTest
Packages in SCC
15
‣ Cycles are not visible.
‣ No information about dependencies.
• Pharo Core 1.1, 78 packages in cycle
What are the differences between these dependencies ?
Friday, June 17, 2011 / 65
DSM as a solution
16
‣ Other existing approaches:
Node-Link Visualization [Gansner 2000, Munzner 2000, Adar 2006]
Package Blueprint [Ducasse 2007]
! For a view of a specific package
Friday, June 17, 2011 / 65
DSM as a solution
16
‣ Other existing approaches:
Node-Link Visualization [Gansner 2000, Munzner 2000, Adar 2006]
Package Blueprint [Ducasse 2007]
! For a view of a specific package
‣ Dependency Structural Matrix
From Process optimisation
Friday, June 17, 2011 / 65
DSM as a solution
16
‣ Other existing approaches:
Node-Link Visualization [Gansner 2000, Munzner 2000, Adar 2006]
Package Blueprint [Ducasse 2007]
! For a view of a specific package
‣ Dependency Structural Matrix
From Process optimisation
‣ Well applied to analyze software architecture
[MacCormack 2006; Sangal 2005; Sullivan 2001, 2006]
Friday, June 17, 2011 / 65
Building a DSM
17
A B
E
D
C
A B
E
D
C
1
1
1
8
2 29
weight = Inheritance + invocation + reference + extension
Friday, June 17, 2011 / 65
Building a DSM
17
A B
E
D
C
A B
E
D
C
1
1
1
8
2 29
DCBAABCDE
E
provides
depends
weight = Inheritance + invocation + reference + extension
Friday, June 17, 2011 / 65
Building a DSM
17
A B
E
D
C
A B
E
D
C
1
1
1
8
2 29
DCBAABCDE
E
provides
dependsX
weight = Inheritance + invocation + reference + extension
Friday, June 17, 2011 / 65
Building a DSM
17
A B
E
D
C
A B
E
D
C
1
1
1
8
2 29
DCBAABCDE
E
provides
depends X
X
X X
X
X
X
weight = Inheritance + invocation + reference + extension
Friday, June 17, 2011 / 65
Building a DSM
17
A B
E
D
C
1
1
1
8
2 29
DCBAABCDE
E
provides
depends 2
1
2 1
8
1
9
weight = Inheritance + invocation + reference + extension
Friday, June 17, 2011 / 65
DSM for software architecture
18
• PharoCore 1.1, 115 packages - 78 in cycle
Friday, June 17, 2011 / 65
DSM for software architecture
18
• PharoCore 1.1, 115 packages - 78 in cycle
[Sangal 2005]
Friday, June 17, 2011 / 65
DSM for software architecture
18
• PharoCore 1.1, 115 packages - 78 in cycle
[Sangal 2005]
Friday, June 17, 2011 / 65
DSM for software architecture
18
• PharoCore 1.1, 115 packages - 78 in cycle
[Sangal 2005]
Friday, June 17, 2011 / 65
Characterisation of a dependency
19
•Current DSM does not provide enough information.
•Contribution: Color print.
Friday, June 17, 2011 / 65
Characterisation of a dependency
19
•Current DSM does not provide enough information.
•Contribution: Color print.
•A dependency can be:
Friday, June 17, 2011 / 65
Characterisation of a dependency
19
•Current DSM does not provide enough information.
•Contribution: Color print.
•A dependency can be:
‣ not in a cycle
A B1
DCBAAB 1
CDE
E
provides
uses
Friday, June 17, 2011 / 65
Characterisation of a dependency
19
•Current DSM does not provide enough information.
•Contribution: Color print.
•A dependency can be:
‣ not in a cycle
‣ in a direct cycle (symetric)
A B1
D
C
1
8
DCBAAB 1
CDE
E
provides
usesDCBA
AB 1
C 1
D 8
E
E
provides
uses
Friday, June 17, 2011 / 65
Characterisation of a dependency
19
•Current DSM does not provide enough information.
•Contribution: Color print.
•A dependency can be:
‣ not in a cycle
‣ in a direct cycle (symetric)
•one dependency lighter than the other
A B1
D
C
1
8
DCBAAB 1
CDE
E
provides
usesDCBA
AB 1
C 1
D 8
E
E
provides
usesDCBA
AB 1
C 1
D 8
E
E
provides
uses
Friday, June 17, 2011 / 65
Characterisation of a dependency
19
•Current DSM does not provide enough information.
•Contribution: Color print.
•A dependency can be:
‣ not in a cycle
‣ in a direct cycle (symetric)
•one dependency lighter than the other
‣ in a SCC
A B
E
D
C
1
1
1
8
2 29
DCBAA 2
B 1
C 2 1
D 8
1
9E
E
provides
usesDCBA
AB 1
C 1
D 8
E
E
provides
usesDCBA
AB 1
C 1
D 8
E
E
provides
uses
Friday, June 17, 2011 / 65
eDSM: macro-reading
20
•A colored cell = a package dependency
‣ Grey = simple reference
‣ Blue = SCC
‣ Pink/red = direct cycle
‣ Yellow = in cycle
• PharoCore 1.1, 115 packages - 78 in a SCC
Friday, June 17, 2011 / 65
eDSM: macro-reading
20
•A colored cell = a package dependency
‣ Grey = simple reference
‣ Blue = SCC
‣ Pink/red = direct cycle
‣ Yellow = in cycle
• PharoCore 1.1, 115 packages - 78 in a SCC
Friday, June 17, 2011 / 65
A cell is a dependency
• A cell = a dependency from a package A to package B21
Package A
Package B
A1
A3
A2
A5A4
B1 B2
B3
Other package
Other package
•Contribution: enriched Cell
Friday, June 17, 2011 / 65
A cell is a dependency
• From Package A to Package B22
Package A
Package B
A1
A3
A2
A5A4
B1 B2
B3
Other package
Other package
•Contribution: enriched Cell
Friday, June 17, 2011 / 65
A cell is a dependency
• From Package A to Package B22
Package A
Package B
A5A4
B1 B2
•Contribution: enriched Cell
Friday, June 17, 2011 / 65
A cell is a dependency
• From Package A to Package B22
A5A4
B2
Package B
B1
Package A
•Contribution: enriched Cell
Friday, June 17, 2011 / 65
A cell is a dependency
• From Package A to Package B22
A5A4
B2
Package B
B1
Package A
Color of the cell
Dependency information
•Contribution: enriched Cell
Friday, June 17, 2011 / 65
A cell is a dependency
• From Package A to Package B22
A5A4
B2
Package B
B1
Package A
Color of the cell
Dependency informationNumber of dependencies:inheritance, invocation, reference, extension
Grey, Pink/Red, Yellow
•Contribution: enriched Cell
Friday, June 17, 2011 / 65
eCell example• From Components-Tools to Platform
23
A5A4
B2
Package B
B1
Package A
Color of the cell
Dependency information
Friday, June 17, 2011 / 65
eCell example• From Components-Tools to Platform
23
A5A4
B2
Package B
B1
Package A
Color of the cell
Dependency information
6 dependencies:6 references (6 classes to 1 class)
In a direct cycle
rate of impacted classes
Friday, June 17, 2011 / 65
eDSM with eCell: Zoom on a SCC
24
Friday, June 17, 2011 / 65
eDSM with eCell: Zoom on a SCC
24
A direct cycle:The red dependency seems better to remove
Friday, June 17, 2011 / 65
eDSM with eCell: Zoom on a SCC
24
2 other candidate dependencies
Friday, June 17, 2011 / 65
eDSM: Evaluations on Moose•Goal:
• Using eDSM to help fixing cycles on one of our systems.
•Context:
• Moose: 108 packages, 19 direct cycles.
•Result:
25
4
15
Removed cyclesCycles kept (for tests)
Friday, June 17, 2011 / 65
eDSM: Evaluations on Seaside•Goal:
• Fix cycles on a system without access to source code.
•Context:
• Seaside 2.8 (33 packages, 25 direct cycles) and Seaside 3.0.
• Between 2.8 and 3.0, explicit modularization of the application.
•Results:
• Seaside developers give us feedback.
26
8!%
37!% 55!%
accepteddifferent changesnot answered
Friday, June 17, 2011 / 65
eDSM: Evaluations by developers•Goal:
• Validating the usefulness of eDSM.
•Context:
• 8 systems with 3 to 108 packages:
•Pharo, Seaside, Moose, Mondrian, XMLParser, SqueakDBX, Merlin, Polymorph
• 9 external participants.
• Participants have a tutorial about eDSM.
27
Friday, June 17, 2011 / 65
eDSM: Evaluations by developers•Goal:
• Validating the usefulness of eDSM
•Result:
28
• Usefulness of eDSM • Usefulness of eCell
9
agree or strongly agreedisagree or strongly disagree
3
6
• Understand structure
• Understand cycles
1
8
1
8
• Understand cycles • Fix a cycle
Friday, June 17, 2011 / 65
eDSM: Evaluations by developers•Goal:
• Validating the usefulness of eDSM
•Result:
29
• Usefulness of eCell features
Considered useful Considered less useful
cell colorheadername of packageedge color
ratio of impacted classesclass colorclass borderpopup with source code
Friday, June 17, 2011 / 65
Contribution: CycleTable
30
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
eDSM is not enough
31
A B
E
D
C
DCBA
A C>A
B A>B
C B>C D>C
D C>D
E>A
B>EE
E
Friday, June 17, 2011 / 65
DCBA
A C>A
B A>B
C B>C D>C
D C>D
E>A
B>EE
E
eDSM without the direct cycles
32
A B
E
D
C
Friday, June 17, 2011 / 65
B
E B>E
C
A C>D
ACEBE>A
B>ED
D
B>C
E>AE>A C>A
C>D
A>B
eDSM without the direct cycles
32
A B
E
D
C
Friday, June 17, 2011 / 65
Cycle decomposition
• Shared dependencies33
A B
E
D
C
Identify dependency that create multiple cycles
Friday, June 17, 2011 / 65
Cycle decomposition
• Shared dependencies33
A B
E
D
C
A B
E
Identify dependency that create multiple cycles
Friday, June 17, 2011 / 65
Cycle decomposition
• Shared dependencies33
A B
E
D
C
A B
C
A B
E
Identify dependency that create multiple cycles
Friday, June 17, 2011 / 65
Cycle decomposition
• Shared dependencies33
A B
E
D
C
A B
C
A B
E
D
C
Identify dependency that create multiple cycles
Friday, June 17, 2011 / 65
Cycle decomposition
• Shared dependencies33
A B
E
D
C
A B
C
A B
E
D
C
Identify dependency that create multiple cycles
Friday, June 17, 2011 / 65
CycleTable
• one cycle in one column34
A B
C
A B
E
D
C
A
B
E
C
D
A>B
B>E
E>A
C>A
B>C
A>B
D>C
C>D
1 1
2 2
2
13
3
Friday, June 17, 2011 / 65
CycleTable
• one cycle in one column34
A B
C
A B
E
D
C
A
B
E
C
D
A>B
B>E
E>A
C>A
B>C
A>B
D>C
C>D
1 1
2 2
2
13
3
Friday, June 17, 2011 / 65
CycleTable
• one cycle in one column34
A B
C
A B
E
D
C
A
B
E
C
D
A>B
B>E
E>A
C>A
B>C
A>B
D>C
C>D
1 1
2 2
2
13
3
Friday, June 17, 2011 / 65
CycleTable
• one cycle in one column34
A B
C
A B
E
D
C
A
B
E
C
D
A>B
B>E
E>A
C>A
B>C
A>B
D>C
C>D
1 1
2 2
2
13
3
Friday, June 17, 2011 / 65
CycleTable
• one cycle in one column34
A B
C
A B
E
D
C
A
B
E
C
D
A>B
B>E
E>A
C>A
B>C
A>B
D>C
C>D
1 1
2 2
2
13
3
Friday, June 17, 2011 / 65
CycleTable: an example
35
Friday, June 17, 2011 / 65
CycleTable: an example
35
Friday, June 17, 2011 / 65
CycleTable: Comparative Study•Goal:
•Validate the effectiveness of CycleTable
•System: •Subsystem of Moose (14 packages)
•Comparison with Node-link visualization
•13 external participants
•Measure of the time spent to answer.
•
36
Friday, June 17, 2011 / 65
Result (time in seconds):
0
50
100
150
200
CycleTable: Conclusion
37
detecting cycles detecting dependencies to break
CycleTable Node-Link
Friday, June 17, 2011 / 65
Result (time in seconds):
0
50
100
150
200
CycleTable: Conclusion
37
detecting cycles detecting dependencies to break
CycleTable Node-Link
Friday, June 17, 2011 / 65
Result (time in seconds):
0
50
100
150
200
CycleTable: Conclusion
37
detecting cycles detecting dependencies to break
CycleTable Node-Link
Friday, June 17, 2011 / 65
Result (time in seconds):
0
50
100
150
200
CycleTable: Conclusion
37
detecting cycles detecting dependencies to break
CycleTable Node-Link
Conclusion:
CycleTable is efficient to retrieve dependencies to break.
On large applications, CycleTable does not scale well.
Shared dependencies is the interesting concept of this analysis.
Friday, June 17, 2011 / 65
Contribution: oZone
38
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
Package Dependency Analysis‣ Cyclic dependencies analysis
‣ Direct cycles
‣ Shared dependencies
•
39
A
B
E
D
C
Friday, June 17, 2011 / 65
Package Dependency Analysis‣ Cyclic dependencies analysis
‣ Direct cycles
‣ Shared dependencies
•
39
A
B
E
D
C
•=> Automate the dependencies selection to help the reengineer ?
•=> Build a layered structure to help understanding.
Friday, June 17, 2011 / 65
Existing approaches
40
‣ Lattix move each SCC in a layer
•[Lattix 2005]A B
E
D
C
Friday, June 17, 2011 / 65
Existing approaches
40
‣ Lattix move each SCC in a layer
•[Lattix 2005]
•=> Does not work with undesired cycles
A B
E
D
C
Friday, June 17, 2011 / 65
Existing approaches
40
‣ Lattix move each SCC in a layer
•[Lattix 2005]
•=> Does not work with undesired cycles
‣ Minimum Feedback Arc Set (MFAS) break the minimum of edges.
•[Melton 2007]
•=> Does not take into account the semantics
A B
E
D
C
Friday, June 17, 2011 / 65
Existing approaches
40
‣ Lattix move each SCC in a layer
•[Lattix 2005]
•=> Does not work with undesired cycles
‣ Minimum Feedback Arc Set (MFAS) break the minimum of edges.
•[Melton 2007]
•=> Does not take into account the semantics
A B
E
D
C
A
B
E
D
C
Friday, June 17, 2011 / 65
Existing approaches
40
‣ Lattix move each SCC in a layer
•[Lattix 2005]
•=> Does not work with undesired cycles
‣ Minimum Feedback Arc Set (MFAS) break the minimum of edges.
•[Melton 2007]
•=> Does not take into account the semantics
‣ Regression and Integration testing technics
•[Le Traon 2000, Da Veiga Cabral 2010]
•=> Minimization of vertices vs minimization of arcs
A B
E
D
C
A
B
E
D
C
Friday, June 17, 2011 / 65
oZone strategy
41
‣ Selecting edges that can break direct cycles.
‣ Selecting edges that are shared dependencies.
‣ User interaction to improve the results
Results are:
A list of dependencies that are interesting to remove.
A layered structure of the application to understand it.
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: example
42
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: example
42
remove direct cycles by ignoring a dependency
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: example
42
A B
E
D
C
remove direct cycles by ignoring a dependency
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: example
42
A B
E
D
C
remove direct cycles by ignoring a dependency
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: example
42
A B
E
D
C
remove direct cycles by ignoring a dependency
remove other cycles by ignoring shared dependencies
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: example
42
A B
E
D
C
A
B
E
D
C
remove direct cycles by ignoring a dependency
remove other cycles by ignoring shared dependencies
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: example
42
A B
E
D
C
A
B
E
D
C
remove direct cycles by ignoring a dependency
remove other cycles by ignoring shared dependencies
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: user interaction
43
A
B
E
D
C
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: user interaction
43
A
B
E
D
C
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: user interaction
43
A
B
E
D
C
Friday, June 17, 2011 / 65
A B
E
D
C
1
1
1
8
2 29
oZone: user interaction
43
A
B
E
D
C
A
B
E
D
C
Friday, June 17, 2011 / 65
oZone: Validation•Comparative Study
‣ Goal: Analyzing the precision
‣ System:
•Pharo (115 packages, 68 packages in cycles).
•Gold standard: manual evaluation of dependencies.
•Comparison with MFAS.
‣ Result before user interaction:
•
44
0
0.175
0.35
0.525
0.7
Precision Recall
0.39
0.61
0.42
0.64
oZone MFAS
Friday, June 17, 2011 / 65
Contribution: Orion
45
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
Famix-Extensions
Moose-Core Famix-Core
An example
46
Friday, June 17, 2011 / 65
An example
47
Class referenceMethod invocationOther dependencies
Legend for dependency arrows:
Famix-Extensions
Moose-Core Famix-Core
Model
inferNamespaceParents
ModelallNamespaces
Namespace
Friday, June 17, 2011 / 65
Famix-Extensions
Moose-Core Famix-Core
Model
inferNamespaceParents
ModelallNamespaces
Namespace
Two dependencies to remove
48
Class referenceMethod invocationOther dependencies
Legend for dependency arrows:
Friday, June 17, 2011 / 65
A possible solution ?
49
Class referenceMethod invocationOther dependencies
Legend for dependency arrows:
Famix-Extensions
Moose-CoreFamix-Core
Model
ModelallNamespaces
Namespace
ModelinferNamespaceParents
Friday, June 17, 2011 / 65
A possible solution ?
49
Class referenceMethod invocationOther dependencies
Legend for dependency arrows:
Famix-Extensions
Moose-CoreFamix-Core
Model
ModelallNamespaces
Namespace
ModelinferNamespaceParents
Friday, June 17, 2011 / 65
Famix-Extensions
Moose-Core Famix-Core
Namespace
ModelinferNamespaceParents
allNamespaces
Model
A better solution ?
50
Class referenceMethod invocationOther dependencies
Legend for dependency arrows:
Friday, June 17, 2011 / 65
Which solution ?
51
?
Famix-Extensions
Moose-CoreFamix-Core
Model
ModelallNamespaces
Namespace
ModelinferNamespaceParents
Famix-Extensions
Moose-Core Famix-Core
Model
inferNamespaceParents
ModelallNamespaces
Namespace
Famix-Extensions
Moose-Core Famix-Core
Namespace
ModelinferNamespaceParents
allNamespaces
Model
Friday, June 17, 2011 / 65
Simulate changes?
‣ How can we represent different models ?
• Keep original model
‣ Overview of the future architecture
• Analysis of multiple solutions
52
Friday, June 17, 2011 / 65
Simulate changes?
‣ How can we represent different models ?
• Keep original model
‣ Overview of the future architecture
• Analysis of multiple solutions
•Existing approaches:
‣ Revision Control System
• Build a model each time to navigate
‣ Naive copy of the whole model
• Too many entities copied when small changes
52
Friday, June 17, 2011 / 65
A B C
v1
Orion: Minimal copy
53
Friday, June 17, 2011 / 65
A B C
v1
Orion: Minimal copy
53
Friday, June 17, 2011 / 65
A B C
B' C'
v1
v2
Orion: Minimal copy
53
Friday, June 17, 2011 / 65
Orion: Access resolution
54
v1: A referencers referencers
=> {C}A B C
B' C'
v1
v2
Friday, June 17, 2011 / 65
Orion: Access resolution
54
v1: A referencers referencers
=> {C}
v2: A referencers referencers
A B C
B' C'
v1
v2
Friday, June 17, 2011 / 65
Orion: Access resolution
54
v1: A referencers referencers
=> {C}
v2: A referencers referencers
A B C
B' C'
v1
v2
Friday, June 17, 2011 / 65
Orion: Access resolution
54
v1: A referencers referencers
=> {C}
v2: A referencers referencers
A B C
B' C'
v1
v2
Friday, June 17, 2011 / 65
Orion: Access resolution
54
v1: A referencers referencers
=> {C}
v2: A referencers referencers
A B C
B' C'
v1
v2
Friday, June 17, 2011 / 65
Orion: Access resolution
54
v1: A referencers referencers
=> {C}
v2: A referencers referencers
=> { }
A B C
B' C'
v1
v2
Friday, June 17, 2011 / 65
Orion Meta-model
55
run(): void
OrionAction
parentVersion
contains(OrionEntity): booleancreateChildVersion(): OrionModelretrieveEntity(OrionEntity): OrionEntity
OrionModel
10..n
OrionContext
currentModel(): OrionModel
FAMIXEntity
FAMIXReference
FAMIXAccess
FAMIXInvocation
FAMIXInheritance
FAMIXClass
FAMIXMethod
FAMIXNamespace
FAMIXPackage
MooseModel
OrionReference
OrionAccess
OrionInvocation
OrionInheritance
OrionClass
OrionMethod
OrionNamespace
OrionPackage
CompositeAction
AtomicAction
currentVersion(): OrionEntityorionID(): Integer
OrionEntity<<interface>>
entities
0..n
11
currentModel
1
0..n
changedEntities
0..n
0..n
2..nchanges
targets
Friday, June 17, 2011 / 65
Orion Meta-model
55
run(): void
OrionAction
parentVersion
contains(OrionEntity): booleancreateChildVersion(): OrionModelretrieveEntity(OrionEntity): OrionEntity
OrionModel
10..n
OrionContext
currentModel(): OrionModel
FAMIXEntity
FAMIXReference
FAMIXAccess
FAMIXInvocation
FAMIXInheritance
FAMIXClass
FAMIXMethod
FAMIXNamespace
FAMIXPackage
MooseModel
OrionReference
OrionAccess
OrionInvocation
OrionInheritance
OrionClass
OrionMethod
OrionNamespace
OrionPackage
CompositeAction
AtomicAction
currentVersion(): OrionEntityorionID(): Integer
OrionEntity<<interface>>
entities
0..n
11
currentModel
1
0..n
changedEntities
0..n
0..n
2..nchanges
targets
Generic MetaModel
Friday, June 17, 2011 / 65
Orion Meta-model
55
run(): void
OrionAction
parentVersion
contains(OrionEntity): booleancreateChildVersion(): OrionModelretrieveEntity(OrionEntity): OrionEntity
OrionModel
10..n
OrionContext
currentModel(): OrionModel
FAMIXEntity
FAMIXReference
FAMIXAccess
FAMIXInvocation
FAMIXInheritance
FAMIXClass
FAMIXMethod
FAMIXNamespace
FAMIXPackage
MooseModel
OrionReference
OrionAccess
OrionInvocation
OrionInheritance
OrionClass
OrionMethod
OrionNamespace
OrionPackage
CompositeAction
AtomicAction
currentVersion(): OrionEntityorionID(): Integer
OrionEntity<<interface>>
entities
0..n
11
currentModel
1
0..n
changedEntities
0..n
0..n
2..nchanges
targets
Generic MetaModel
Implemented on top of Famix
Friday, June 17, 2011 / 65
Orion: Case Studies
56
‣ Goal: Using Orion in real environment
Combined with eDSM
‣ System: Packages in cycle
Direct cycles
Entities
Pharo 1.0 68 180 800 000
Moose 17 19 150 000
Friday, June 17, 2011 / 65
Orion: Case Studies
56
‣ Goal: Using Orion in real environment
Combined with eDSM
‣ System:
‣ Result on a 2 hours session:
Packages in cycle
Direct cycles
Entities
Pharo 1.0 68 180 800 000
Moose 17 19 150 000
Versions Actions Removed cycles
Pharo 1.0 11 29 18
Moose 7 22 15
Friday, June 17, 2011 / 65
‣ Goal: Comparing with naive copy:
Memory used
Time to create a model
Time to access entities
‣ System:
•Moose, 150 000 entities.
•Random actions.
Orion: Benchmark on Moose
57
Friday, June 17, 2011 / 65
‣ Goal: Comparing with naive copy.
‣ Result on 20 versions with 10 actions in each one:
Orion: Benchmark on Moose
58
naive copy Orion model
memory 100Mb / version 10 Mb / version
creation time ~60s / version 3s / version
Access time 1 x 2
Friday, June 17, 2011 / 65
eCOO Summary
59
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
eDSM: Summary
•Challenge
‣ Understanding cycles in the large
‣ Understanding Direct Cycles
•Contributions
‣ Direct cycle analysis
‣ Cycle visualization
•Publications
‣ WCRE 2009
‣ Journal SPE (submitted)
60
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
CycleTable: Summary
•Challenge
‣ Evaluating cyclic dependencies
•Contributions
‣ Cycle Visualization
‣ Shared dependencies
•Publications
‣ Technical Report
61
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
oZone: Summary
•Challenge
‣ Selecting unwanted dependencies
•Contributions
‣ Strategy to detect unwanted dependencies
•Publications
‣ Benevol 2010
‣ Journal SCP (submitted)
62
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
Orion: Summary
•Challenge
‣ Simulation of changes
•Contributions
‣ Simulation on model
•Publications
‣ Journal SCP
•Used by other researchers
‣ Andy Kellens
63
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Friday, June 17, 2011 / 65
identifying cycles
selecting unwanted
dependencies
assessing changes
source code
model
eDSMCycleTable
oZone
Orion
eCOO
Other Results
64
•Technical contribution
‣ Results for the Pharo and Moose communities
‣ Tools integrated in Moose releasewww.moosetechnology.org
•Dissemination
‣ Visits (Annecy, Bern, Bordeaux, Nantes, ...)
‣ Tutorial (on moosetechnology.org)
‣ Demonstration (Club Qualimetrie)
•Other contributions
‣ Metrics (CSMR 2010), Undesired cycles (Tools 2011)
Friday, June 17, 2011 / 65
Open issues and perspectives‣ We need feedback from communities, we should find
new project to analyze.
65
Friday, June 17, 2011 / 65
Open issues and perspectives‣ We need feedback from communities, we should find
new project to analyze.
‣ Can we define a pattern to detect unwanted dependencies and unwanted cycles ? a semantic pattern ?
• Using it in oZone Strategy.
65
Friday, June 17, 2011 / 65
Open issues and perspectives‣ We need feedback from communities, we should find
new project to analyze.
‣ Can we define a pattern to detect unwanted dependencies and unwanted cycles ? a semantic pattern ?
• Using it in oZone Strategy.
‣ Impact / Cost analysis of package changes.
65
Friday, June 17, 2011 / 65
Open issues and perspectives‣ We need feedback from communities, we should find
new project to analyze.
‣ Can we define a pattern to detect unwanted dependencies and unwanted cycles ? a semantic pattern ?
• Using it in oZone Strategy.
‣ Impact / Cost analysis of package changes.
‣ Introducing eCOO in the whole life cycle of the software, with an incremental approach.
•Detecting unwanted dependencies as soon as possible.
•Orion coupled with automatic refactoring.
65