aspect mining for large systems
DESCRIPTION
Demonstrated at OOPSLA 2006.TRANSCRIPT
![Page 1: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/1.jpg)
Silvia BreuUniversity of Cambridge
Thomas ZimmermannSaarland University
Christian LindigSaarland University
HAM:Aspect Mining
![Page 2: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/2.jpg)
Aspectscreate()
fork()
connect()
close()
serve()
![Page 3: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/3.jpg)
Aspectscreate()
fork()
connect()
close()
serve()
![Page 4: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/4.jpg)
Aspectscreate()
fork()
connect()
close()
serve()
Typical Aspectsenter()/leave()log()lock()/unlock()
lock()
![Page 5: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/5.jpg)
Aspectscreate()
fork()
connect()
close()
serve()
AOP
Typical Aspectsenter()/leave()log()lock()/unlock()
lock()
![Page 6: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/6.jpg)
Aspectscreate()
fork()
connect()
close()
serve()
AOP
Aspect Mining:Identifying Aspectsin Legacy Code
Typical Aspectsenter()/leave()log()lock()/unlock()
lock()
![Page 7: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/7.jpg)
Research Hypothesis
Cross-cutting concerns emerge over time.
![Page 8: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/8.jpg)
Cross-cutting concerns emerge over time.
![Page 9: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/9.jpg)
Demo #1
![Page 10: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/10.jpg)
Modelling History142Transactions
![Page 11: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/11.jpg)
MODIFICATIONS
Modelling History142Transactions
![Page 12: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/12.jpg)
MODIFICATIONS
Modelling History142Transactions
DELETIONS
![Page 13: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/13.jpg)
MODIFICATIONS
Modelling History142Transactions
DELETIONSADDITIONS
![Page 14: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/14.jpg)
MODIFICATIONS
Modelling History142Transactions
DELETIONSADDITIONS
143
![Page 15: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/15.jpg)
Code Additions
public void _aload_0(int pc) { dumpPcNumber(pc); buffer.append(OpcodeStringValues .BYTECODE_NAMES [IOpcodeMnemonics.ALOAD_0]); writeNewLine();}
Location: _aload_0
![Page 16: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/16.jpg)
public void _aload_0(int pc) { dumpPcNumber(pc); buffer.append(OpcodeStringValues .BYTECODE_NAMES [IOpcodeMnemonics.ALOAD_0]); writeNewLine();}
Location: _aload_1
Code Additions
Location: println
public void _aload_0(int pc) { dumpPcNumber(pc); buffer.append(OpcodeStringValues .BYTECODE_NAMES [IOpcodeMnemonics.ALOAD_0]); writeNewLine();}
Location: _aload_0
![Page 17: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/17.jpg)
142 143141
Co-Addition of Calls
config()connect()
serve()close()
init()
![Page 18: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/18.jpg)
142 143141
Co-Addition of Calls
config()connect()
serve()close()
init()
lock()
![Page 19: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/19.jpg)
142 143141
Co-Addition of Calls
config()connect()
serve()close()
init()
lock()
unlock()
![Page 20: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/20.jpg)
142 143141
Co-Addition of Calls
config()connect()
serve()close()
init()
lock()
unlock()
“fixed bug#1234 by adding proper locks”
lock()unlock()
Cross-Cutting Change
![Page 21: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/21.jpg)
Transaction as a Table
calls
loca
tions
![Page 22: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/22.jpg)
Transaction as a Table
calls
loca
tions
charA
t
runDFAThis Tx added among others a call to charAt in location runDFA
![Page 23: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/23.jpg)
Blocks = Aspect Candidates
calls
loca
tions
lockun
lock
fgh
sync
method sync is called from locations d, e, f, g, h, i, k
{sync} is an aspect candidate
ed
ik
![Page 24: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/24.jpg)
Computing all Blocks
![Page 25: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/25.jpg)
Computing all Blocks
![Page 26: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/26.jpg)
Concept Analysis
calls
loca
tions
Concept Analysis computes all blocks.
![Page 27: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/27.jpg)
Concept Analysis
calls
loca
tions
Concept Analysis computes all blocks.
![Page 28: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/28.jpg)
Concept Analysis
calls
loca
tions
Concept Analysis computes all blocks.
![Page 29: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/29.jpg)
Concept Analysis
calls
loca
tions
Concept Analysis computes all blocks.
![Page 30: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/30.jpg)
Example from Eclipse2004-03-01
![Page 31: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/31.jpg)
Example from Eclipse2004-03-01
nodes reflect size of cross-cutting concern
# locations
# methods
![Page 32: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/32.jpg)
Example from Eclipse2004-03-01
14 locations callunsupportedIn2()
nodes reflect size of cross-cutting concern
# locations
# methods
![Page 33: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/33.jpg)
Example from Eclipse2004-03-01
History contains cross-cutting changes.
14 locations callunsupportedIn2()
nodes reflect size of cross-cutting concern
# locations
# methods
![Page 34: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/34.jpg)
Demo #2
![Page 35: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/35.jpg)
Reinforcement
connect()close()
METHOD: lock()
Aspect Candidate
LOCATIONS: init()serve()
METHOD: lock()
Aspect Candidate
LOCATIONS:
![Page 36: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/36.jpg)
Reinforcement
connect()close()
METHOD: lock()
Aspect Candidate
LOCATIONS: init()serve()
METHOD: lock()
Aspect Candidate
LOCATIONS:
connect()close()
METHOD: lock()
Aspect Candidate
LOCATIONS:
init()serve()
+
![Page 37: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/37.jpg)
Locality
![Page 38: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/38.jpg)
Locality
41 4239 40 43 44 45
christom silvichrischris chrissilvi
![Page 39: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/39.jpg)
Locality
41 4239 40 43 44 45
christom silvichrischris chrissilvi42
![Page 40: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/40.jpg)
Locality
41 4239 40 43 44 45
christom silvichrischris chrissilvi42
Temporal locality
![Page 41: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/41.jpg)
christom silvichrischris chrissilvi
Locality
41 4239 40 43 44 4542
Temporal locality
![Page 42: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/42.jpg)
Locality
41 4239 40 43 44 4542
Temporal locality
christom silvichrischris chrissilvi
![Page 43: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/43.jpg)
Locality
41 4239 40 43 44 4542
Temporal locality
Possessionallocality
christom silvichrischris chrissilvi
![Page 44: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/44.jpg)
Locality
41 4239 40 43 44 4542
Temporal locality
Possessionallocality
christom silvichrischris chrissilvi
➡ merging transactions and running concept analysis.
![Page 45: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/45.jpg)
Results for Eclipse
max
Transactions (43270)
avg
blocks
locations
methods
1235 3.7
1287 3.8
1236 5.4
The average transactionis small. It adds 5 calls in 4 locations.
![Page 46: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/46.jpg)
Results for Eclipse
max
Transactions (43270)
avg
blocks
locations
methods
1235 3.7
1287 3.8
1236 5.4
The average transactionis small. It adds 5 calls in 4 locations.
112 candidates add3 calls or more.
1
Aspect Candidates*
methods
362 88 24candidates 1878
2 3 ≥4
* selected from 159448 blocks
![Page 47: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/47.jpg)
public static final native void _XFree(int address);public static final void XFree(int /*long*/ address) { lock.lock(); try { _XFree(address); } finally { lock.unlock(); }}
Locking Mechanism
![Page 48: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/48.jpg)
public static final native void _XFree(int address);public static final void XFree(int /*long*/ address) { lock.lock(); try { _XFree(address); } finally { lock.unlock(); }}
Locking Mechanism
crosscuts 1284
locations
![Page 49: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/49.jpg)
Future work
• Evolution of cross-cutting concerns.Refactor only those that actually change.
• Relation between cross-cutting concerns
• Refactoring of concerns.
• Package and ship HAM.
![Page 50: Aspect Mining for Large Systems](https://reader038.vdocuments.mx/reader038/viewer/2022110122/559b7f161a28abf9758b466a/html5/thumbnails/50.jpg)
Conclusions
• Cross-cutting concerns emerge over time.
• Cross-cutting changes point to aspect candidates.
• HAM scales to industrial-sized systems.
• http://www.st.cs.uni-sb.de/softevo/