Aspect Mining for Large Systems

Thomas Zimmermann
Thomas ZimmermannResearcher at Microsoft Research
HAM:
Aspect Mining

   Silvia Breu
   University of Cambridge

   Thomas Zimmermann
   Saarland University

   Christian Lindig
   Saarland University
Aspects
create()   connect()




           close()




serve()




           fork()
Aspects
create()   connect()




           close()




serve()




           fork()
Aspects
create()   connect()     lock()



                                  Typical Aspects
                                  enter()/leave()
                                  log()
           close()




                                  lock()/unlock()
serve()




           fork()
Aspects
create()   connect()     lock()



                                  Typical Aspects
                                  enter()/leave()
                                  log()
           close()

                          AOP
                                  lock()/unlock()
serve()




           fork()
Aspects
create()   connect()     lock()



                                  Typical Aspects
                                  enter()/leave()
                                  log()
           close()

                          AOP
                                  lock()/unlock()
serve()




           fork()

                                  Aspect Mining:
                                  Identifying Aspects
                                  in Legacy Code
Research Hypothesis


 Cross-cutting concerns
   emerge over time.
Cross-cutting concerns
  emerge over time.
Demo #1
Modelling History
Transactions   142
Modelling History
Transactions            142

        MODIFICATIONS
Modelling History
Transactions            142

        MODIFICATIONS
       DELETIONS
Modelling History
Transactions             142

         MODIFICATIONS
       DELETIONS
      ADDITIONS
Modelling History
Transactions             142   143

         MODIFICATIONS
       DELETIONS
      ADDITIONS
Code Additions

Location: _aload_0

public void _aload_0(int pc)
{
      dumpPcNumber(pc);
      buffer.append(OpcodeStringValues
        .BYTECODE_NAMES
        [IOpcodeMnemonics.ALOAD_0]);
      writeNewLine();
}
Code Additions
    Location: _aload_1
  Location: println
    public void _aload_0(int pc)
   {
Location: _aload_0
           dumpPcNumber(pc);
           buffer.append(OpcodeStringValues
public void _aload_0(int pc)
              .BYTECODE_NAMES
{
              [IOpcodeMnemonics.ALOAD_0]);
      dumpPcNumber(pc);
           writeNewLine();
      buffer.append(OpcodeStringValues
     } .BYTECODE_NAMES
        [IOpcodeMnemonics.ALOAD_0]);
      writeNewLine();
}
Co-Addition of Calls
141                        142   143

                 config()
               connect()
             serve()
          close()
       init()
Co-Addition of Calls
141                        142            143

                 config()
               connect()
             serve()
          close()
       init()

                                 lock()
Co-Addition of Calls
141                        142              143

                 config()
               connect()
             serve()
          close()
       init()

                                 lock()

                                 unlock()
Co-Addition of Calls
141                                     142              143

                              config()
                            connect()
                          serve()
                       close()
                    init()

                                              lock()

                                              unlock()


      “fixed bug#1234 by
      adding proper locks”

                    Cross-Cutting Change
                    lock()
                    unlock()
Transaction as a Table
                      calls
locations
Transaction as a Table
                              t
                            rA
                          ha      calls
                        c

runDFA
                                          This Tx added
                                          among others a
                                          call to charAt in
                                          location runDFA
    locations
Blocks = Aspect Candidates
                         k lock
                nc     ocun
                     l
             sy                   calls
   d
                                          method sync is called from
   e
                                          locations d, e, f, g, h, i, k
   f
   g
   h
   i
                                                {sync} is an
   k
                                             aspect candidate
 locations
Computing all Blocks
Computing all Blocks
Concept Analysis
            calls
locations




            Concept Analysis computes all blocks.
Concept Analysis
            calls
locations




            Concept Analysis computes all blocks.
Concept Analysis
            calls
locations




            Concept Analysis computes all blocks.
Concept Analysis
            calls
locations




            Concept Analysis computes all blocks.
Example from Eclipse
2004-03-01
Example from Eclipse
2004-03-01
                      nodes reflect size of
                      cross-cutting concern
                        # locations




                               # methods
Example from Eclipse
2004-03-01
                      nodes reflect size of
                      cross-cutting concern
                        # locations




                               # methods



                      14 locations call
                      unsupportedIn2()
Example from Eclipse
2004-03-01
                                       nodes reflect size of
                                       cross-cutting concern
                                         # locations




                                                # methods



                                       14 locations call
                                       unsupportedIn2()

      History contains cross-cutting changes.
Demo #2
Reinforcement
Aspect Candidate       Aspect Candidate
METHOD:                METHOD:
           lock()                 lock()
LOCATIONS: connect()   LOCATIONS: init()
           close()                serve()
Reinforcement
Aspect Candidate                              Aspect Candidate



                                 +
METHOD:                                       METHOD:
           lock()                                        lock()
LOCATIONS: connect()                          LOCATIONS: init()
           close()                                       serve()




                       Aspect Candidate
                       METHOD:    lock()
                       LOCATIONS: connect()
                                  close()
                                  init()
                                  serve()
Locality
Locality

chris   chris   tom chris silvi   silvi   chris
 39      40      41   42    43     44      45
Locality

chris   chris   tom chris silvi   silvi   chris
 39      40      41   42    43     44      45
Locality

chris   chris   tom chris silvi   silvi   chris
 39      40      41   42    43     44      45




                  Temporal
                   locality
Locality

chris   chris   tom chris silvi   silvi   chris
 39      40      41   42    43     44      45




                  Temporal
                   locality
Locality

chris   chris   tom chris silvi   silvi   chris
 39      40      41   42    43     44      45




                  Temporal
                   locality
Locality

 chris   chris   tom chris silvi   silvi   chris
  39      40      41   42    43     44      45




Possessional       Temporal
  locality          locality
Locality

 chris   chris     tom chris silvi            silvi   chris
  39      40         41    42     43           44      45




Possessional          Temporal
  locality             locality

               ➡ merging transactions and
                  running concept analysis.
Results for Eclipse
     Transactions (43270)
             max       avg
                             The average transaction
blocks       1235      3.7
                             is small. It adds 5 calls
methods      1236      5.4
                             in 4 locations.
locations    1287      3.8
Results for Eclipse
       Transactions (43270)
                     max             avg
                                                The average transaction
blocks             1235              3.7
                                                is small. It adds 5 calls
methods              1236            5.4
                                                in 4 locations.
locations            1287            3.8

      Aspect Candidates*
                                                112 candidates add
methods          1         2    3          ≥4
                                                3 calls or more.
candidates 1878 362             88         24
* selected from 159448 blocks
Locking Mechanism
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
public static final native void _XFree(int address);
public static final void XFree(int /*long*/ address) {

                            284
                       ts 1
      lock.lock();

                   scu
               os
            cr
      try {

                          ns
            _XFree(address);
                      tio
                  oca
                l
      } finally {
            lock.unlock();
      }
}
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.
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/
1 of 50

More Related Content

What's hot(20)

Similar to Aspect Mining for Large Systems(20)

Survey onhpcs languagesSurvey onhpcs languages
Survey onhpcs languages
Saliya Ekanayake426 views
GoでKVSを書けるのかGoでKVSを書けるのか
GoでKVSを書けるのか
Moriyoshi Koizumi1.5K views
Blocks & GCDBlocks & GCD
Blocks & GCD
rsebbe2.4K views
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
Azul Systems, Inc.543 views
Clojure IntroClojure Intro
Clojure Intro
thnetos10.5K views
Fork Join (BeJUG 2012)Fork Join (BeJUG 2012)
Fork Join (BeJUG 2012)
Sander Mak (@Sander_Mak)2.1K views
PydiomaticPydiomatic
Pydiomatic
rik0924 views
Python idiomaticoPython idiomatico
Python idiomatico
PyCon Italia908 views
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
PRADEEP766 views
Clojure+ClojureScript WebappsClojure+ClojureScript Webapps
Clojure+ClojureScript Webapps
Falko Riemenschneider355 views
Cp7 rpcCp7 rpc
Cp7 rpc
bhaktinalawade275 views
Clojure 1.1 And BeyondClojure 1.1 And Beyond
Clojure 1.1 And Beyond
Mike Fogus1.1K views
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
Charles Nutter11K views

More from Thomas Zimmermann(20)

MSR 2013 PreviewMSR 2013 Preview
MSR 2013 Preview
Thomas Zimmermann21.8K views
Analytics for smarter software development Analytics for smarter software development
Analytics for smarter software development
Thomas Zimmermann2.6K views
Klingon Countdown TimerKlingon Countdown Timer
Klingon Countdown Timer
Thomas Zimmermann1.3K views
Data driven games user researchData driven games user research
Data driven games user research
Thomas Zimmermann1.5K views
Analytics for software developmentAnalytics for software development
Analytics for software development
Thomas Zimmermann4.6K views
Cross-project defect predictionCross-project defect prediction
Cross-project defect prediction
Thomas Zimmermann1.9K views
Meet Tom and his FishMeet Tom and his Fish
Meet Tom and his Fish
Thomas Zimmermann1.5K views
Got Myth? Myths in Software EngineeringGot Myth? Myths in Software Engineering
Got Myth? Myths in Software Engineering
Thomas Zimmermann5.9K views
Mining Workspace Updates in CVSMining Workspace Updates in CVS
Mining Workspace Updates in CVS
Thomas Zimmermann632 views
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
Thomas Zimmermann16.1K views
esolang: Esoterische Programmiersprachenesolang: Esoterische Programmiersprachen
esolang: Esoterische Programmiersprachen
Thomas Zimmermann1.5K views

Recently uploaded(20)

CXL at OCPCXL at OCP
CXL at OCP
CXL Forum183 views
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
Prity Khastgir IPR Strategic India Patent Attorney Amplify Innovation23 views
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh34 views
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL Preview
CXL Forum118 views
ChatGPT and AI for Web DevelopersChatGPT and AI for Web Developers
ChatGPT and AI for Web Developers
Maximiliano Firtman152 views

Aspect Mining for Large Systems