interconnection styles
DESCRIPTION
Interconnection Styles. export. export. use. M1. M4. use. use. use. M5. M2. SS4. SS2. M6. use. M3. export. SS3. SS1. S. Software Design Following the Export (Server) Style. SS1. Software Design Following the Export (Client) Style. ec. ec. use. M1. M4. use. use. use. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/1.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Interconnection Styles
![Page 2: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/2.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Software Design Following the Export (Server) Style
SS1
M1
M2use
SS2
M3SS3export
M4
M5
use
SS4
use
M6
export
exportuse
use
S
![Page 3: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/3.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Software Design Following the Export (Client) Style
SS1
M1
M2use
SS2
M3SS3
M4
M5
use
SS4
use
M6
use
use
Sec
ec
ec
![Page 4: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/4.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Software Design Following the Export Client / Export Style
SS1
M1
M2use
SS2
M3SS3
M4
M5
use
SS4
use
M6
use
use
Sec
ec
ec
export
export
export
![Page 5: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/5.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Software Design Following the Import Style
SS1
M1
M2use
SS2
M3SS3
M4
M5
use
SS4
use
M6
use
use
S
import
import
![Page 6: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/6.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Software Design Following the Import / Export Style
SS1
M1
M2use
SS2
M3SS3
M4
M5
use
SS4
use
M6
use
use
S
export
export
export
import
import
![Page 7: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/7.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Software Design Following the Tube Style
SS1
M1
M2use
SS2
M3SS3
M4
M5
use
SS4
use
M6
use
use
S
tube
tube
tube
![Page 8: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/8.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Interconnection Style Formalism
• An ISF specification consists of a finite set of logic rules. There are two kinds of ISF rules:– Permission: Determine the syntactically legal
relations between the components of a software design.
– Definition: Define new relations based on patterns of entities and relations.
![Page 9: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/9.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Interconnection Style Formalism (Cont’d)
• Each rule consists of a finite set of entities and relations.
• Entities represent design components and relations represent interconnections between these components.
![Page 10: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/10.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Set ofMathematical
Relations(Interpret.)
Set ofDatalogFacts
Set ofLogic
Formulas(Theory)
Set ofDatalogRules
Satisfies? Union
model not model
Model-TheoryView
DatalogView
DesignView
satisfiesstyle
does not satisfystyle
SS1
M1
M2use
SS2
M3SS3export
M4
M5use
SS4use
M6
export
exportuse
use
S
input
SS1
M1M2use
SS2M3
SS3export
M4M5useSS4
use
M6
exportexportuse
useS
SS1
M1M2use
SS2M3
SS3export
M4M5useSS4
use
M6
exportexportuse
useS
SS1
M1M2use
SS2M3
SS3export
M4M5useSS4
use
M6
exportexportuse
useS
SS1
M1M2use
SS2M3
SS3export
M4M5useSS4
use
M6
exportexportuse
useS
SS1
M1M2use
SS2M3
SS3export
M4M5useSS4
use
M6
exportexportuse
useS
Wellformed?Yes/no
![Page 11: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/11.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Design Example
M2
M3 M4
M5
use
export
export
SS2.1
M6
use
SS2
M1
SS1
use
use
SS1.1
use
![Page 12: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/12.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Design Example in Datalog
![Page 13: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/13.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Formal Definition of ISF
• The syntax of ISF is described by presenting the visual symbols of the notation.
• These symbols represent design:– entities
– relations
– rules
• The semantics of ISF is described using Datalog.
![Page 14: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/14.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Formal Definition of ISF
• The semantics of ISF is presented bottom-up:– semantics of ISF entities and relations– semantics of ISF rules in terms of the semantics
of entities and relations
![Page 15: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/15.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF Entities
• ISF entities are depicted as labeled rectangles.
• Each ISF entity represents a set of typed design components such as:– modules, classes, subsystems, etc.
• There are three types of entities:
label label label
![Page 16: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/16.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Example of an ISF Entity• An example of an ISF entity is:
• Formally: subsystem(SS)– where SS is a free variable.
• Informally: “The set of all subsystems in a software design.”
Subsystem
![Page 17: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/17.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF Relations
• ISF relations are depicted as:– labeled edges– nested rectangles
• Each ISF relation represents a relation of a software design such as:– containment (depicted as nested rectangles)– import– export– inherit, etc.
![Page 18: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/18.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF Containment Relations
subsystem
subsystem
subsystem
subsystem
Contain(PSS,SS),subsystem(PSS)subsystem(SS)
rtc_contain(PSS,SS),subsystem(PSS)subsystem(SS)
e2e1
1. Entity contains simple entity
e2
e1
2. Entity contains transitive entity
e2e1
1. Entity contains permission entity
![Page 19: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/19.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF Edge Relations
e1 e2
e1 e2
1. Simple Relation
r
2. Negated Simple Relation
3. Reflexive Transitive Relation
e1 e2
r
r
e1 e2
4. Negated Reflexive Transitive Relation
r
e1 e2r
5,6. Permission or Definition Relation
![Page 20: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/20.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Examples of Edge Relations
subsystem
subsystemsubsystemsubsystemsubsystem
subsystemsubsystemsubsystem
useuse
useuse
rtc_use(SS1,SS2),subsystem(SS1),subsystem(SS2)
use(SS1,SS2),subsystem(SS1),subsystem(SS2)
not(use(SS1,SS2)),subsystem(SS1),subsystem(SS2)
not(rtc_use(SS1,SS2)),subsystem(SS1),subsystem(SS2)
tc_r(X,Y) :- r(X,Y).tc_r(X,Y) :- r(X,Z), tc_r(Z,Y).rtc_c(X,Y) :- X = Y.rtc_r(X,Y) :- tc_r(X,Y).
![Page 21: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/21.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF Rules:The Export Style (Part 1)
ssss
PERMIT PERMIT
ssss
export
wf_export(PSS,SS) :- ss(PSS), ss(SS), contain(PSS,SS).ill_formed() :- export(X,Y), not(wf_export(X,Y)).
wf_contain(PSS,SS) :- ss(PSS),ss(SS).
ill_formed() :- contain(X,Y), not(wf_contain(X,Y)).
well_formed_design() :- not(ill_formed()).
![Page 22: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/22.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF Rules:The Export Style (Part 2)
![Page 23: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/23.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Export Client / Export Style
![Page 24: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/24.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Import / Export Style (Part 1)
![Page 25: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/25.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Import / Export Style (Part 2)
![Page 26: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/26.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Tube Style (Part1)
![Page 27: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/27.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Tube Style (Part 2)
![Page 28: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/28.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
On the Automatic Recovery of Style-Specific
Structural Dependencies
![Page 29: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/29.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Introduction
• Motivation
• Definitions– MDG– Clustering– Interconnection Styles– ISF
• Examples
• Tool
![Page 30: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/30.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Motivation
• Documentation problems:– Missing or inaccurate design documentation
– Poorly documented code
– Original programmers not available for consultation
• Program understanding. Need for high-level information– Existing clustering techniques do not produce high-
level dependencies.
• Design validation
![Page 31: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/31.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Module Dependency Graph
• Nodes represent modules
• Edges represent dependencies between modules (i.e. method invocation, variable reference, etc)
• Obtained automatically with Cia, Acacia, Chava
![Page 32: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/32.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Example: Mini Tunis MDG
![Page 33: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/33.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Clustering
• Aggregate representation of MDG, that groups together modules that are tightly coupled
• Clusters represent subsystems
• Obtained automatically with Bunch
![Page 34: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/34.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Example: Mini Tunis after clustering
![Page 35: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/35.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Structure Graph
• A clustered system may be visualized as a tree– Edges represent
containment, use and style dependencies
– Nodes represent modules and subsystems
• Easier to visualize large systems
![Page 36: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/36.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Interconnection Styles
• Regulate the interactions between modules and subsystems
• High-level relations not present in source code or clustered system.
• Can be described formally with the Interconnection Style Formalism (ISF)
![Page 37: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/37.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Example: Export Style
• Export style facilitates the specification of subsystem interfaces.
• If a subsystem S exports a module M, M belongs to S’s interface.
• Modules outside of S can use modules belonging to S’s interface.
![Page 38: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/38.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Example: Export Style
• M3 can use M4 because it is exported by SS21 and SS21 is exported by SS2.
• M6 cannot use M5 because it is not exported by SS21. If M6 did use M5 there would be a stylistic violation.
![Page 39: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/39.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF
• Visual notation that allows specification of constraints on configurations of components and dependencies
• Rules are represented as directed labeled graphs– Nodes: modules and subsystems– Arrows: dependencies and containment
relations
![Page 40: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/40.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF (cont’d)
• Types of rules:– PERMISSION: define the set of well-formed
configurations– DEFINITION: define new relations based on
patterns of software components and relations.
![Page 41: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/41.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
ISF Specification of Export Style
exportcontain export*
containcontain
contain* contain*
see
see
use
PERMIT(1)
PERMIT(2)
DEFINE(1)
not equal
contain
![Page 42: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/42.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Example: Mini Tunis after Edge Repair
![Page 43: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/43.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Tool
• Style Editor– Enables the user to define custom
interconnection styles visually
• Edge Repair Utility– Takes structure graph and style and finds the
missing structural dependencies automatically– Checks if a design satisfies stylistic constraints
![Page 44: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/44.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Integration of Reverse Engineering Tools
Source CodeAnalysis Tool
ClusteringTool (Bunch)
ModuleDependency
Graph
f or (int i;...) {...}
SourceCode
Edge RepairUtility
exp
c
c c
c
cc
Well-formedDesign
ClusteredMDG
Style Definition
DEFINE(1)PERMIT(1)
c exp
see
c c
c c exp
![Page 45: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/45.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Techniques
• Edge Repair
• Rule Checking
• Code Generation
![Page 46: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/46.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Edge Repair
• Given– Structure Graph • Style definition
exportcontain export*
containcontain
contain* contain*
see
see
use
PERMIT(1)
PERMIT(2)
DEFINE(1)
not equal
contain
![Page 47: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/47.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Edge Repair
• Goal: find the missing style dependencies such that:– Visibility between modules is minimized– No dependency (i.e., use or style) violates any
stylistic constraint.
![Page 48: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/48.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Algorithms
• Huge search space (i.e. cannot try all possible combinations)
• Optimization methods:– Hill climbing: start with a random configuration and
find better ones by making small changes
– Edge removal: start with “full” configuration and remove edges until no better solution can be found
– Genetic algorithm
![Page 49: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/49.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Fitness Function
• Measures the quality of a configuration– Good:
• Configurations with a large number of well-formed use relations
– Bad:• Configurations with a large number of ill-formed
style dependencies
• Configurations with high visibility (many see relations)
![Page 50: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/50.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Simplistic visibility
• Computing visibility is an O(N2) operation • Frequent operation• Approach: simplistic visibility
– Approximation to standard visibility– Given by the number of style dependencies– O(1) operation
• Drawback: does not work for some styles– Non-recursive (permission rules are not defined in
terms of other permission rules)– Modules are exposed by direct (i.e., non-transitive)
relations with their ancestors.
![Page 51: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/51.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Fitness Function
• ifu: ill-formed use dependencies• ifs: ill-formed style dependencies• wfu: well-formed use dependencies• wfs: well-formed style dependencies• MaxS: maximum number of style dependencies in C
0,0,02
0,0,01
0or 0
)(
wfsifuifsMaxS
wfsifuifswfs
MaxS
ifuifsifuifs
wfs
Cquality
![Page 52: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/52.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Hill Climbing
• Start from random configuration of dependencies• Select an edge, to add or remove, such that the
new configuration is better than the current one• Repeat until no better solution can be found
![Page 53: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/53.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Edge Removal
• Start from full configuration• Remove edges that makes the current solution
better until no better solution can be found
![Page 54: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/54.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Hill Climbing vs. Edge Removal
• Hill Climbing– Adds relations and
then removes them (might add unnecessary relations)
• Edge Removal– Always starts with a
full configuration (even if only a few relations are required)
– Fewer neighbors to consider as the algorithm advances
![Page 55: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/55.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Performance:Hill Climbing vs. Edge Removal
Hill Climbing Edge Removal
Compiler
(19 nodes)
0.19 s 0.14 s
Mini Tunis
(32 nodes)
0.8 s 0.46 s
Grappa
(117 nodes)
8.5 s 3.67 s
Incl
(212 nodes)
25.72 s 9.2 s
![Page 56: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/56.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Genetic Algorithm
• Encoding
• Crossover
• Fitness function
• Mutation
1 2 3 4 51 0 0 0 1 02 0 0 0 1 03 0 0 0 0 04 0 0 0 0 05 0 0 0 0 0
visibilityifnu
wfufitness
ml
k
cb
a
![Page 57: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/57.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Optimizations
• Pessimistic edge reparability: avoid processing relations that can never exist (e.g., export relations between siblings in the Export Style)
• Simplistic visibility measurement: based on the number of style dependencies in a configuration (reduces O(N2) operation to O(1)).
![Page 58: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/58.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Rule Checking
• Goal: check well-formedness of a dependency with respect to a permission rule.
• Can be reduced to a pattern matching problem => the rule is matched to the structure graph.
cc
c c
c
c*c
c c
c
c*c
c c
c
![Page 59: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/59.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Pattern Matching
• Invalid pattern matches:
cc
c c
cc*
c
c c
c
![Page 60: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/60.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Pattern Matching Algorithm
• Based on Depth-First Search– State:
• Set of fixed nodes
• Set of free nodes
– Goal: find a state with no free nodes– Initial state: the set of fixed nodes contains the
endpoints of the relation being checked
![Page 61: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/61.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Pattern Matching Example
A B
expc*
imp
!=
imp
c*
C
A B
expc*
imp
!=
imp
c*
E
A B
expc*
imp
!=
imp
c*
A
A B
expc*
imp
!=
imp
c*
H
A B
expc*
imp
!=
imp
c*
E D
A B
expc*
imp
!=
imp
c*
H
F
G
E
DC
A B I
c
impimp
imp
exp
c c
c c
c
ccimp
Structure Graph
N2 N3
N0 N1
expc*
!=
imp
c*
Permission Rule
![Page 62: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/62.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Choosing the Node to Fix
• If the node is not connected to a fixed node, it can assume any value (i.e., N possibilities)
• Choose a node connected to a fixed node to constrain the possible values for the node
![Page 63: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/63.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Pessimistic Edge Reparability Algorithm
• Algorithm: based on the pattern matching– Full configuration with all dependencies as unknown
– Repeat until no more unknown dependencies exist• Pick a dependency tagged as unknown
• Check if it is reparable (i.e., perform a pattern match of every related permission rule). If an unknown dependency is found during the match, check its reparability (i.e., recursive call of this algorithm)
• If a match is found and all involved dependencies are reparable, tag the relation as reparable. If not, tag it as irreparable.
![Page 64: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/64.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Code Generation
• Java code is generated to check each rule– Take advantage of Java’s compile-time and
run-time optimizations– Some decision making is performed when the
rule is translated instead of when it is checked
![Page 65: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/65.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Code Optimization
• Take advantage of the fact that– Rules are static– Search tree depth is fixed and known for each
rule (depends on the number of nodes in the rule).
• … to determine the order in which rule’s nodes are fixed at translation time.
![Page 66: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/66.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Code Optimization (cont’d)
• When rules look like trees (most times), topological sorting can give a good ordering of nodes .
A
c*B 2
1
![Page 67: Interconnection Styles](https://reader035.vdocument.in/reader035/viewer/2022070404/56813aa4550346895da29d6f/html5/thumbnails/67.jpg)
Reverse Engineering Reverse Engineering (Interconnection Styles)(Interconnection Styles) © SERG
Conclusion
• Tool – find missing high-level dependencies in a
system– validate a design against a style specification
• Further research:– Optimization of edge repair algorithm (e.g.,
using incremental algorithms)• Replace the “simplistic visibility” measurement
– Repairing designs by reclustering.