SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
Towards Reusable
          Components with Aspects:
An Empirical Study on Modularity and Obliviousness

                Kevin Hoffman / Patrick Eugster
Seen code that looks like this?




                         (Carlo H. Séquin @ Berkeley)                   (speedcubing.com)




   (George W. Hart @ Stony Brook)           (George W. Hart @ Stony Brook)
Roadmap

 AOP with AspectJ
 Challenges
 Cooperative AOP with Explicit Join Points
 Empirical Study
     How obliviousness can be traded for increased
      modularity and reuse through Cooperative AOP
     Potential pitfalls and guidelines
Cross-cutting Concerns




     (Thanks to AspectJ Dev Tools (AJDT) Visualization Eclipse Perspective)
Cross-cutting Concerns




     (Thanks to AspectJ Dev Tools (AJDT) Visualization Eclipse Perspective)
Real Crosscutting Concerns

 Logging (canonical example)
 Pooling / caching
 Dependency injection
 Policy / contract enforcement
 Security
 Transactions
 Exception Handling
AOP & Crosscutting Concerns
Separation
Modularization
AOP Stratagems [Filman/Friedman’00]

 Obliviousness
   Increased modularity of base code and aspect code
   Parallel and domain-specific development
   Better post-mortem extendibility

 Quantification (pattern matching)
   Reduction in code size and duplicity
   Higher level interaction between primary and cross-
   cutting concerns
AspectJ

 AspectJ [Kiczales ’01]
 Join point model
     Structural points in ‘base code’

   Quantification model (pointcuts)
     Lexical patterns and type constraints
     Dynamic predicates and control flow

   Aspects inject advice before, after, around…
Looks Nice, However…
Aspect  Base Code Coupling
Fragile Pointcuts
Base Code                       Aspect Code
private void initScreens(       public aspect
         ServletContext ctxt,     WafViewTemplateHandler
                                  extends
         String language)
                                  ExceptionGenericAspect
{                               {
  …                               pointcut initScrGetResHdlr():
  screenDefURL =                    withincode(
         ctxt.getResource(…);            private void
  …                                      TemplateServlet.
}                                         initScreens(
                                              ServletContext,
                                              String))
                                    && call(URL ServletContext
                                        .getResource(String));
                                  …
                                }
State—Point Separation Issue
Base Code                  aspect AbortedTranAnalyzer {
                           //========POSSIBLE========
try {                      pointcut gotOldExc(OldExc ex):
   …                          handler(OldExc) && args(ex);
} catch (OldExc e) {       pointcut abortedTran(Tran tr):
   t.abortTrans(…);           call(* *.abortTrans(..))
   throw new                   && target(tr);
      GenExc (quot;failedquot;);
}                          pointcut gotGenExc(GenExc ex):
                              initialization(GenExc.new(..))
                               && target(ex);
                           //======NOT POSSIBLE=======
                           pointcut get3State(OldExc old,
                                          Tran tr, GenExc gen):
                              gotOldExc(old)
                               && abortedTran(tr)
                               && gotGenExc(ex);
                           }
State—Point Separation Issue
Base Code                  aspect AbortedTranAnalyzer {
                           //========POSSIBLE========
try {                      pointcut gotOldExc(OldExc ex):
   …                          handler(OldExc) && args(ex);
} catch (OldExc e) {       pointcut abortedTran(Tran tr):
   t.abortTrans(…);           call(* *.abortTrans(..))
   throw new                   && target(tr);
      GenExc (quot;failedquot;);
}                          pointcut gotGenExc(GenExc ex):
                              initialization(GenExc.new(..))
                               && target(ex);
                           //======NOT POSSIBLE=======
                           pointcut get3State(OldExc old,
                                          Tran tr, GenExc gen):
                              gotOldExc(old)
                               && abortedTran(tr)
                               && gotGenExc(ex);
                           }
State—Point Separation Issue
Base Code                  aspect AbortedTranAnalyzer {
                           //========POSSIBLE========
try {                      pointcut gotOldExc(OldExc ex):
   …                          handler(OldExc) && args(ex);
} catch (OldExc e) {       pointcut abortedTran(Tran tr):
   t.abortTrans(…);           call(* *.abortTrans(..))
   throw new                   && target(tr);
      GenExc (quot;failedquot;);
}                          pointcut gotGenExc(GenExc ex):
                              initialization(GenExc.new(..))
                               && target(ex);
                           //======NOT POSSIBLE=======
                           pointcut get3State(OldExc old,
                                          Tran tr, GenExc gen):
                              gotOldExc(old)
                               && abortedTran(tr)
                               && gotGenExc(ex);
                           }
State—Point Separation Issue
Base Code                  aspect AbortedTranAnalyzer {
                           //========POSSIBLE========
try {                      pointcut gotOldExc(OldExc ex):
   …                          handler(OldExc) && args(ex);
} catch (OldExc e) {       pointcut abortedTran(Tran tr):
   t.abortTrans(…);           call(* *.abortTrans(..))
   throw new                   && target(tr);
      GenExc (quot;failedquot;);
}                          pointcut gotGenExc(GenExc ex):
                              initialization(GenExc.new(..))
                               && target(ex);
                           //======NOT POSSIBLE=======
                           pointcut get3State(OldExc old,
                                          Tran tr, GenExc gen):
                              gotOldExc(old)
                               && abortedTran(tr)
                               && gotGenExc(ex);
                           }
State—Point Separation Issue
Base Code                  aspect AbortedTranAnalyzer {
                           //========POSSIBLE========
try {                      pointcut gotOldExc(OldExc ex):
   …                          handler(OldExc) && args(ex);
} catch (OldExc e) {       pointcut abortedTran(Tran tr):
   t.abortTrans(…);           call(* *.abortTrans(..))
   throw new                   && target(tr);
      GenExc (quot;failedquot;);
}                          pointcut gotGenExc(GenExc ex):
                              initialization(GenExc.new(..))
                               && target(ex);
                           //======NOT POSSIBLE=======
                           pointcut get3State(OldExc old,
                                          Tran tr, GenExc gen):
                              gotOldExc(old)
                               && abortedTran(tr)
                               && gotGenExc(ex);
                           }
AspectJ-specific Problems

 Abstract aspects can’t share pointcuts
 Anonymous advice --> hard to advise aspects
 Blocks of code inside methods not advisable
 Pointcuts can’t parameterize advice
Lack of Advice Parameterization
Base Code                   aspect ExceptionPrinter {
                                pointcut p1(Exc1 ex):
try {                              handler(Exc1) && args(ex);
   …                            before(Exception ex):
} catch (Exc1 e) {                 p1(ex) || p2(ex)
   println(quot;timeoutquot;);          { handleExc(quot;timeoutquot;, thisJP); }
}
try {                           pointcut p2(Exc2 ex):
   …                               handler(Exc2) && args(ex);
} catch (Exc2 e) {              before(Exception ex):
   println(quot;net failedquot;);          p1(ex) || p2(ex)
}                               { handleExc(“net failedquot;, thisJP); }

                                void handleExc(String m,
                                                   JoinPoint jp) {
                                  println(jp + quot;:quot; + m); …
                                }
                            }
Some Proposed Techniques

 Aspect-aware Interfaces [Kiczales, Mezini ‘05]
 Open Modules [Aldrich ‘05]
 HyperJ [Ossher, Tarr ‘00]
 Classpects [Rajan, Sullivan ‘05]
 CaesarJ [Aracic, Gasiunas, Mezini, Ostermann ‘06]
 XPIs [Sullivan et. al. ‘05]
 Explicit Join Points [Hoffman, Eugster ‘07]
Explicit Join Points (EJPs)

   Abstract a cross-cutting concern to its most
    essential form
     Invoke the information hiding principle


   Model the abstraction explicitly using named
    join points instead of implicit join points

   Reference EJPs in code explicitly
     Or use aspects to inject EJP references obliviously
Aspect  Base Code Coupling
Cooperative AOP Methodology




    AspectJ: 39 AspectBase couplings
EJPs: 11 AspectInterface, 15 BaseInterface
Comparison of Approaches
   AspectJ:
                         Base Code                Aspects



   AspectJ with EJPs (Cooperative AOP):
                             Library Interfaces        Pluggable Libraries



        Base Code              EJP Interfaces                Aspects



    Scoped EJPs, pointcutargs and thisblock, advice
    parameterization by type/value, and policy enforcement
Building Aspect Libraries with EJPs

   Define semantic interfaces of cross-cutting
    concerns using interfaces and EJPs
     Package these in a JAR
   Define aspects that advise the EJPs to
    implement the cross cutting concerns
     Package each implementation in a different JAR
   Write base code or aspects to reference EJPs
     Choose aspect implementation JAR at load-time
   As the EJPs evolve, use aspects to obliviously
    adapt calls from old EJPs to new EJPs
EJPs Address…

 Fragile pointcuts
 State—point separation problem
 Abstract aspects can’t share pointcuts
 Anonymous advice
 Blocks of code inside methods not advisable
 Pointcuts can’t parameterize advice
Sullivan—Levels of Obliviousness

  Language-level (i.e. language support for AOP)
  Feature obliviousness—base code unaware of
   features in aspects, but do know of preconditions

  Designer obliviousness—
       Base code programmers blissfully unaware…
  Pure obliviousness—
       Complete, symmetric separation
This Empirical Study




 What are the tradeoffs
  between modularity
  and obliviousness?
This Empirical Study
   Refactored Exception Handling for 3 Java Apps:
     Using AspectJ
     Using EJPs / Cooperative AOP

   Empirical Metrics Measuring:
     Coupling & Cohesion
     Size & Complexity
     Separation of Concerns
     Reusability

   Revisiting ‘Exceptions and Aspects’ @ FSE06
    [Filho et. al.] – Thanks!
Target Applications

   Telestrada (Java)
     220+ classes and interfaces, 3400 LOC

   Java Pet Store (Java)
     340+ classes and interfaces,17800 LOC

   Health Watcher (AspectJ)
     36 aspects, 96 classes and interfaces, 6600 LOC
     Aspects for CC, distribution, persistence, some EH
Refactoring Strategy (AspectJ)
BEFORE                  AFTER
class C {               aspect A {
  void m() throws … {     pointcut p():
    try { /*body*/ }        execution(void C.m());
    catch(E e) { … }      void around(): p() {
  }                         try {
}                              proceed();
                            } catch (E e) { … }
                          }
                          declare soft: E: p();
                        }
                        class C {
                          void m(){ /*body*/ }
                        }
Refactoring Strategy (EJPs)
BEFORE                  AFTER
class C {               aspect A {
  void m() throws … {     scoped joinpoint ejpH()
    try { /*body*/ }        handles E throws …;
    catch(E e) { … }      void around() throws …:
  }                         call(ejpScope(ejpH))
}                         {
                            try{ proceed(); }
                            catch(E e) { … }
                          }
                        }
                        class C {
                          void m() throws … {
                            A.ejpH(){ /*body*/ }
                          }
                        }
Empirical Metrics
   Coupling Between Modules (CBM)
   Coupling on Intercepted Modules (CIM)
   Lack of Cohesion of Operations (LCO)
   Lines of Code (LOC) / Concern LOC (CLOC)
   Number of Operations (NoO)
   Concern Diffusion over Modules (CDoM)
   Concern Diffusion over Operations (CDoO)
   Concern Diffusion over Lines of Code (CDoLOC)
   Reusable Operation Use Percentage (ROUP)
Coupling Metrics
   Coupling Between Modules (CBM)
     Number of other modules referenced via field access
      or method call or EJP reference
     Extended to include reference to EJP interfaces
     [Chidamber, Kemerer 1994]

           class C {
             void m1(B var1, B var2) {
               A.ejpH(){ var1.m3(); }
               C.m2();
               var2.m4();
                                         CBM = 2
             }                            (A and B)
             static void m2() { … }
           }
Coupling Between Modules
Coupling Metrics

   Coupling on Intercepted Modules (CIM)
     # of modules explicitly named in pointcuts
     [Ceccato, Tonella 2004]

       pointcut initScrGetResHdlr():
         withincode(
              private void
              TemplateServlet.
               initScreens(
                   ServletContext,      CIM = 3
                   String))
         && call(URL ServletContext
             .getResource(String));
Coupling on Intercepted Modules
Cohesion Metric

   Lack of Cohesion in Operations (LCO)
     # of method pairs accessing different fields minus
      # of method pairs accessing common fields
     Helps to measure commonality of purpose

         class C {
            Object f1, f2, f3;
                                          LCO = 2
            void m1() { f1=…; }
            void m2() { f2=…; }
            void m3() { f3=…; }
            void m4() { f1=…; f2=…;}
         }
                Disjoint Pairs: m1-m2, m1-m3, m2-m3, m3-m4
           Non-Disjoint Pairs: m1-m4, m2-m4
Lack of Cohesion of Operations
Size / Complexity Metrics

   Lines of Code (LOC)
     # of lines of code without whitespace / comments

   Concern Lines of Code (CLOC)
     # of lines of code required to implement the exception
      handling concern
   Number of Operations (NoO)
     Number of declared methods and advice
Lines of Code
Concern Lines of Code
Number of Operations
Separation of Concern Metrics

   Concern Diffusion over Modules (CDoM)
     # of modules that implement a concern
     … OR reference one that does

   Concern Diffusion over Operations (CDoO)
     # of operations that implement a concern
     … OR reference one that does
Concern Diffusion over Modules
Concern Diffusion over Operations
Separation of Concern Metrics

   Concern Diffusion over Lines of Code
     # of transitions between one concern to another


class C {                        class C {
  void m() throws … {              void m() throws … {
    try {                            A.ejpHandler() {
      /*                               /*
          body                            body
      */                               */
    } catch(E e) { … }               }
  }                                }
}                                }
Concern Diffusion over LOC
% of handlers implemented by
abstract aspects or EJP library
                                  Exception Handler Reuse
Reusable Exception Handler EJPs

 Ignore exception
 Print/log exception
 Rethrow different exception or its cause
 On exception set variable to value
 Propagate exception if flagged



    16 EJPs covered 74% of all handlers
Empirically, This Happens
Cooperative AOP Can Help




    AspectJ: 39 AspectBase couplings
EJPs: 11 AspectInterface, 15 BaseInterface
Conclusions

   Explicit Interfaces and EJP references:
     Provided effective means for advice
      parameterization
     Greatly increased aspect reusability
     Must be carefully designed, ideally in advance



   Greatest software quality achieved when using
    combination of obliviousness + EJPs
Future Work
                                         JSR-308 includes
                                          proposal for annotations
                                          on statements
                                         Study interactions
                                          between obliviousness
                                          and software quality in
                                          the presence of multiple
                                          cross-cutting concerns

                     kjhoffma@cs.purdue.edu
                     peugster@cs.purdue.edu

Download papers, slides, and compiler at http://www.kevinjhoffman.com/
(SUPPORTING SLIDES)
Addressing EJP Explicitness

 Use EJPs only when appropriate
 Design EJPs so that their presence is minimal


       Base Code        EJP Interfaces   Aspects


 Use aspects to reference EJPs as appropriate
 Aspect-oriented code editors
     Fluid AOP [Hon / Kiczales]
Empirical Metrics Formulated…

   Coupling, Cohesion, Separation of Concerns
     On the reuse and maintenance of Aspect-Oriented
      software: [Sant’Anna et. al. 2000]
   AspectBase Code Coupling
     Measuring the effects of software aspectization
      [Ceccato/Tonella 2004]
   http://aopmetrics.tigris.org/
Empirical Studies Emerging…
   Separation of Concerns in Multi-agent Systems: An
    Empirical Study [2004]
   Modularizing design patterns with aspects: a quantitative
    study [AOSD’05]
   Composing design patterns: a scalability study of aspect-
    oriented programming [AOSD’06]
   Exceptions and aspects: the devil is in the details [FSE’06]
   On the impact of aspectual decompositions on design
    stability: An empirical study [ECOOP’07]
   Towards Reusable Components with Aspects [ICSE’08]
   Evolving Software Product Lines with Aspects [ICSE’08]
Explicit Join Point Declarations


abstract aspect TranConcern {
  scoped joinpoint void enterTrans(int isolation)
        throws TranException;
}         Keyword to  Explicit Name to Associate
              Declare EJP      with Abstract Semantics

  Optional       Constraints Acting             Explicit Value
  Modifiers       Upon Base Code               Parameterization
Referencing EJPs in Base Code
abstract aspect TranConcern {
  scoped joinpoint void enterTrans(int isolation)
          throws TranException;
  joinpoint int defIso() = 1;   Some policy aspect could
}                              implement/override this EJP


void someMethod() throws TranException {
  TranConcern.enterTrans(TranConcern.defIso()) {
      //block of code
  } Reference to scoped EJP;        Reference to
} entire block of code is advised EJP in base code
Advising EJPs in Aspects
aspect TranConcernViaSomeLibrary {
   void around(int iso) throws TranException:
           call(ejpScope(TranConcern.enterTrans))
           && args(iso) {
   TransContext t = …;
   t.beginTrans();
   try {
       proceed(); /* calls original block of code */
       t.commitTrans();
   } catch(Throwable e) {
       t.abortTrans();
       throw TranException(e);
}}
Advising EJPs in Aspects

aspect BillingComponentsTranPolicy {
  int around(): call(ejp(TranConcern.defIso))
                && within (com.me.billing.*)
  { return 4; } //use a higher isolation level in billing pkg
}

aspect ForceIsolationLevel {
  int around(): call(ejp(TranConcern.defIso))
             && cflow(call(* CreditCard+.*(..)))
  { return 5; } //anytime the call stack includes a method
}               //from the CreditCard class use iso level 5

Weitere ähnliche Inhalte

Was ist angesagt?

Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++Seok-joon Yun
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
 
Random stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchRandom stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchKashyap Adodariya
 
Fine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFELFine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFELThomas Zimmermann
 
2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticino2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticinoArnaud Bos
 
Java, Up to Date Sources
Java, Up to Date SourcesJava, Up to Date Sources
Java, Up to Date Sources輝 子安
 
The Ring programming language version 1.5.3 book - Part 88 of 184
The Ring programming language version 1.5.3 book - Part 88 of 184The Ring programming language version 1.5.3 book - Part 88 of 184
The Ring programming language version 1.5.3 book - Part 88 of 184Mahmoud Samir Fayed
 
Parsing with Perl6 Grammars
Parsing with Perl6 GrammarsParsing with Perl6 Grammars
Parsing with Perl6 Grammarsabrummett
 
Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Kim Hunmin
 
생산적인 개발을 위한 지속적인 테스트
생산적인 개발을 위한 지속적인 테스트생산적인 개발을 위한 지속적인 테스트
생산적인 개발을 위한 지속적인 테스트기룡 남
 
PyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutinePyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutineDaehee Kim
 
Beyond Breakpoints: Advanced Debugging with XCode
Beyond Breakpoints: Advanced Debugging with XCodeBeyond Breakpoints: Advanced Debugging with XCode
Beyond Breakpoints: Advanced Debugging with XCodeAijaz Ansari
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbroncymbron
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorFedor Lavrentyev
 
The Ring programming language version 1.5.1 book - Part 75 of 180
The Ring programming language version 1.5.1 book - Part 75 of 180The Ring programming language version 1.5.1 book - Part 75 of 180
The Ring programming language version 1.5.1 book - Part 75 of 180Mahmoud Samir Fayed
 

Was ist angesagt? (20)

Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
 
Random stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchRandom stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbench
 
Fine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFELFine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFEL
 
2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticino2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticino
 
Java, Up to Date Sources
Java, Up to Date SourcesJava, Up to Date Sources
Java, Up to Date Sources
 
The Ring programming language version 1.5.3 book - Part 88 of 184
The Ring programming language version 1.5.3 book - Part 88 of 184The Ring programming language version 1.5.3 book - Part 88 of 184
The Ring programming language version 1.5.3 book - Part 88 of 184
 
Parsing with Perl6 Grammars
Parsing with Perl6 GrammarsParsing with Perl6 Grammars
Parsing with Perl6 Grammars
 
Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Lexical environment in ecma 262 5
Lexical environment in ecma 262 5
 
생산적인 개발을 위한 지속적인 테스트
생산적인 개발을 위한 지속적인 테스트생산적인 개발을 위한 지속적인 테스트
생산적인 개발을 위한 지속적인 테스트
 
Java
JavaJava
Java
 
PyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutinePyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into Coroutine
 
Beyond Breakpoints: Advanced Debugging with XCode
Beyond Breakpoints: Advanced Debugging with XCodeBeyond Breakpoints: Advanced Debugging with XCode
Beyond Breakpoints: Advanced Debugging with XCode
 
Magic methods
Magic methodsMagic methods
Magic methods
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 
PHP 5 Magic Methods
PHP 5 Magic MethodsPHP 5 Magic Methods
PHP 5 Magic Methods
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
3
33
3
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
 
The Ring programming language version 1.5.1 book - Part 75 of 180
The Ring programming language version 1.5.1 book - Part 75 of 180The Ring programming language version 1.5.1 book - Part 75 of 180
The Ring programming language version 1.5.1 book - Part 75 of 180
 

Andere mochten auch

Aspect-oriented Transactions via Explicit Join Points
Aspect-oriented Transactions via Explicit Join PointsAspect-oriented Transactions via Explicit Join Points
Aspect-oriented Transactions via Explicit Join PointsKevin Hoffman
 
Towards Probabilistic Assessment of Modularity
Towards Probabilistic Assessment of ModularityTowards Probabilistic Assessment of Modularity
Towards Probabilistic Assessment of ModularityKevin Hoffman
 
Introduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join PointsIntroduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join PointsKevin Hoffman
 
Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]
Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]
Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]Kevin Hoffman
 
Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...
Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...
Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...Kevin Hoffman
 
Semantics-Aware Trace Analysis [PLDI 2009]
Semantics-Aware Trace Analysis [PLDI 2009]Semantics-Aware Trace Analysis [PLDI 2009]
Semantics-Aware Trace Analysis [PLDI 2009]Kevin Hoffman
 
Bridging Java And AspectJ [PPPJ08]
Bridging Java And AspectJ [PPPJ08]Bridging Java And AspectJ [PPPJ08]
Bridging Java And AspectJ [PPPJ08]Kevin Hoffman
 

Andere mochten auch (7)

Aspect-oriented Transactions via Explicit Join Points
Aspect-oriented Transactions via Explicit Join PointsAspect-oriented Transactions via Explicit Join Points
Aspect-oriented Transactions via Explicit Join Points
 
Towards Probabilistic Assessment of Modularity
Towards Probabilistic Assessment of ModularityTowards Probabilistic Assessment of Modularity
Towards Probabilistic Assessment of Modularity
 
Introduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join PointsIntroduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join Points
 
Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]
Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]
Aspects Made Explicit for Safe Transactional Semantics [DSN 2006]
 
Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...
Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...
Aspect-based Introspection And Change Analysis For Evolving Programs [RAMSE @...
 
Semantics-Aware Trace Analysis [PLDI 2009]
Semantics-Aware Trace Analysis [PLDI 2009]Semantics-Aware Trace Analysis [PLDI 2009]
Semantics-Aware Trace Analysis [PLDI 2009]
 
Bridging Java And AspectJ [PPPJ08]
Bridging Java And AspectJ [PPPJ08]Bridging Java And AspectJ [PPPJ08]
Bridging Java And AspectJ [PPPJ08]
 

Ähnlich wie Towards Reusable Components With Aspects [ICSE 2008]

Round PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing FunctionallyRound PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing FunctionallySean Cribbs
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test frameworkAbner Chih Yi Huang
 
Unit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaUnit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaRobot Media
 
Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17LogeekNightUkraine
 
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxwhitneyleman54422
 
Shipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLabShipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLabDobromir Nikolov
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good TestsTomek Kaczanowski
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheeltcurdt
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lispkyleburton
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVMVaclav Pech
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best PracticesJohannes Hoppe
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Phil Calçado
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...corehard_by
 
Apache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationApache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationBartosz Konieczny
 
PHP Static Code Review
PHP Static Code ReviewPHP Static Code Review
PHP Static Code ReviewDamien Seguy
 
NetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience ReportNetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience ReportAnton Arhipov
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Platonov Sergey
 

Ähnlich wie Towards Reusable Components With Aspects [ICSE 2008] (20)

Round PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing FunctionallyRound PEG, Round Hole - Parsing Functionally
Round PEG, Round Hole - Parsing Functionally
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test framework
 
Unit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaUnit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon Galicia
 
Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17
 
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
 
Shipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLabShipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLab
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheel
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
 
Stop Monkeys Fall
Stop Monkeys FallStop Monkeys Fall
Stop Monkeys Fall
 
Apache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationApache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customization
 
C++11 - STL Additions
C++11 - STL AdditionsC++11 - STL Additions
C++11 - STL Additions
 
PHP Static Code Review
PHP Static Code ReviewPHP Static Code Review
PHP Static Code Review
 
Exception Handling in Scala
Exception Handling in ScalaException Handling in Scala
Exception Handling in Scala
 
NetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience ReportNetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience Report
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.
 

Kürzlich hochgeladen

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Kürzlich hochgeladen (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Towards Reusable Components With Aspects [ICSE 2008]

  • 1. Towards Reusable Components with Aspects: An Empirical Study on Modularity and Obliviousness Kevin Hoffman / Patrick Eugster
  • 2. Seen code that looks like this? (Carlo H. Séquin @ Berkeley) (speedcubing.com) (George W. Hart @ Stony Brook) (George W. Hart @ Stony Brook)
  • 3. Roadmap  AOP with AspectJ  Challenges  Cooperative AOP with Explicit Join Points  Empirical Study  How obliviousness can be traded for increased modularity and reuse through Cooperative AOP  Potential pitfalls and guidelines
  • 4. Cross-cutting Concerns (Thanks to AspectJ Dev Tools (AJDT) Visualization Eclipse Perspective)
  • 5. Cross-cutting Concerns (Thanks to AspectJ Dev Tools (AJDT) Visualization Eclipse Perspective)
  • 6. Real Crosscutting Concerns  Logging (canonical example)  Pooling / caching  Dependency injection  Policy / contract enforcement  Security  Transactions  Exception Handling
  • 10. AOP Stratagems [Filman/Friedman’00]  Obliviousness  Increased modularity of base code and aspect code  Parallel and domain-specific development  Better post-mortem extendibility  Quantification (pattern matching)  Reduction in code size and duplicity  Higher level interaction between primary and cross- cutting concerns
  • 11. AspectJ  AspectJ [Kiczales ’01]  Join point model  Structural points in ‘base code’  Quantification model (pointcuts)  Lexical patterns and type constraints  Dynamic predicates and control flow  Aspects inject advice before, after, around…
  • 13. Aspect  Base Code Coupling
  • 14. Fragile Pointcuts Base Code Aspect Code private void initScreens( public aspect ServletContext ctxt, WafViewTemplateHandler extends String language) ExceptionGenericAspect { { … pointcut initScrGetResHdlr(): screenDefURL = withincode( ctxt.getResource(…); private void … TemplateServlet. } initScreens( ServletContext, String)) && call(URL ServletContext .getResource(String)); … }
  • 15. State—Point Separation Issue Base Code aspect AbortedTranAnalyzer { //========POSSIBLE======== try { pointcut gotOldExc(OldExc ex): … handler(OldExc) && args(ex); } catch (OldExc e) { pointcut abortedTran(Tran tr): t.abortTrans(…); call(* *.abortTrans(..)) throw new && target(tr); GenExc (quot;failedquot;); } pointcut gotGenExc(GenExc ex): initialization(GenExc.new(..)) && target(ex); //======NOT POSSIBLE======= pointcut get3State(OldExc old, Tran tr, GenExc gen): gotOldExc(old) && abortedTran(tr) && gotGenExc(ex); }
  • 16. State—Point Separation Issue Base Code aspect AbortedTranAnalyzer { //========POSSIBLE======== try { pointcut gotOldExc(OldExc ex): … handler(OldExc) && args(ex); } catch (OldExc e) { pointcut abortedTran(Tran tr): t.abortTrans(…); call(* *.abortTrans(..)) throw new && target(tr); GenExc (quot;failedquot;); } pointcut gotGenExc(GenExc ex): initialization(GenExc.new(..)) && target(ex); //======NOT POSSIBLE======= pointcut get3State(OldExc old, Tran tr, GenExc gen): gotOldExc(old) && abortedTran(tr) && gotGenExc(ex); }
  • 17. State—Point Separation Issue Base Code aspect AbortedTranAnalyzer { //========POSSIBLE======== try { pointcut gotOldExc(OldExc ex): … handler(OldExc) && args(ex); } catch (OldExc e) { pointcut abortedTran(Tran tr): t.abortTrans(…); call(* *.abortTrans(..)) throw new && target(tr); GenExc (quot;failedquot;); } pointcut gotGenExc(GenExc ex): initialization(GenExc.new(..)) && target(ex); //======NOT POSSIBLE======= pointcut get3State(OldExc old, Tran tr, GenExc gen): gotOldExc(old) && abortedTran(tr) && gotGenExc(ex); }
  • 18. State—Point Separation Issue Base Code aspect AbortedTranAnalyzer { //========POSSIBLE======== try { pointcut gotOldExc(OldExc ex): … handler(OldExc) && args(ex); } catch (OldExc e) { pointcut abortedTran(Tran tr): t.abortTrans(…); call(* *.abortTrans(..)) throw new && target(tr); GenExc (quot;failedquot;); } pointcut gotGenExc(GenExc ex): initialization(GenExc.new(..)) && target(ex); //======NOT POSSIBLE======= pointcut get3State(OldExc old, Tran tr, GenExc gen): gotOldExc(old) && abortedTran(tr) && gotGenExc(ex); }
  • 19. State—Point Separation Issue Base Code aspect AbortedTranAnalyzer { //========POSSIBLE======== try { pointcut gotOldExc(OldExc ex): … handler(OldExc) && args(ex); } catch (OldExc e) { pointcut abortedTran(Tran tr): t.abortTrans(…); call(* *.abortTrans(..)) throw new && target(tr); GenExc (quot;failedquot;); } pointcut gotGenExc(GenExc ex): initialization(GenExc.new(..)) && target(ex); //======NOT POSSIBLE======= pointcut get3State(OldExc old, Tran tr, GenExc gen): gotOldExc(old) && abortedTran(tr) && gotGenExc(ex); }
  • 20. AspectJ-specific Problems  Abstract aspects can’t share pointcuts  Anonymous advice --> hard to advise aspects  Blocks of code inside methods not advisable  Pointcuts can’t parameterize advice
  • 21. Lack of Advice Parameterization Base Code aspect ExceptionPrinter { pointcut p1(Exc1 ex): try { handler(Exc1) && args(ex); … before(Exception ex): } catch (Exc1 e) { p1(ex) || p2(ex) println(quot;timeoutquot;); { handleExc(quot;timeoutquot;, thisJP); } } try { pointcut p2(Exc2 ex): … handler(Exc2) && args(ex); } catch (Exc2 e) { before(Exception ex): println(quot;net failedquot;); p1(ex) || p2(ex) } { handleExc(“net failedquot;, thisJP); } void handleExc(String m, JoinPoint jp) { println(jp + quot;:quot; + m); … } }
  • 22. Some Proposed Techniques  Aspect-aware Interfaces [Kiczales, Mezini ‘05]  Open Modules [Aldrich ‘05]  HyperJ [Ossher, Tarr ‘00]  Classpects [Rajan, Sullivan ‘05]  CaesarJ [Aracic, Gasiunas, Mezini, Ostermann ‘06]  XPIs [Sullivan et. al. ‘05]  Explicit Join Points [Hoffman, Eugster ‘07]
  • 23. Explicit Join Points (EJPs)  Abstract a cross-cutting concern to its most essential form  Invoke the information hiding principle  Model the abstraction explicitly using named join points instead of implicit join points  Reference EJPs in code explicitly  Or use aspects to inject EJP references obliviously
  • 24. Aspect  Base Code Coupling
  • 25. Cooperative AOP Methodology AspectJ: 39 AspectBase couplings EJPs: 11 AspectInterface, 15 BaseInterface
  • 26. Comparison of Approaches  AspectJ: Base Code Aspects  AspectJ with EJPs (Cooperative AOP): Library Interfaces Pluggable Libraries Base Code EJP Interfaces Aspects Scoped EJPs, pointcutargs and thisblock, advice parameterization by type/value, and policy enforcement
  • 27. Building Aspect Libraries with EJPs  Define semantic interfaces of cross-cutting concerns using interfaces and EJPs  Package these in a JAR  Define aspects that advise the EJPs to implement the cross cutting concerns  Package each implementation in a different JAR  Write base code or aspects to reference EJPs  Choose aspect implementation JAR at load-time  As the EJPs evolve, use aspects to obliviously adapt calls from old EJPs to new EJPs
  • 28. EJPs Address…  Fragile pointcuts  State—point separation problem  Abstract aspects can’t share pointcuts  Anonymous advice  Blocks of code inside methods not advisable  Pointcuts can’t parameterize advice
  • 29. Sullivan—Levels of Obliviousness  Language-level (i.e. language support for AOP)  Feature obliviousness—base code unaware of features in aspects, but do know of preconditions  Designer obliviousness—  Base code programmers blissfully unaware…  Pure obliviousness—  Complete, symmetric separation
  • 30. This Empirical Study What are the tradeoffs between modularity and obliviousness?
  • 31. This Empirical Study  Refactored Exception Handling for 3 Java Apps:  Using AspectJ  Using EJPs / Cooperative AOP  Empirical Metrics Measuring:  Coupling & Cohesion  Size & Complexity  Separation of Concerns  Reusability  Revisiting ‘Exceptions and Aspects’ @ FSE06 [Filho et. al.] – Thanks!
  • 32. Target Applications  Telestrada (Java)  220+ classes and interfaces, 3400 LOC  Java Pet Store (Java)  340+ classes and interfaces,17800 LOC  Health Watcher (AspectJ)  36 aspects, 96 classes and interfaces, 6600 LOC  Aspects for CC, distribution, persistence, some EH
  • 33. Refactoring Strategy (AspectJ) BEFORE AFTER class C { aspect A { void m() throws … { pointcut p(): try { /*body*/ } execution(void C.m()); catch(E e) { … } void around(): p() { } try { } proceed(); } catch (E e) { … } } declare soft: E: p(); } class C { void m(){ /*body*/ } }
  • 34. Refactoring Strategy (EJPs) BEFORE AFTER class C { aspect A { void m() throws … { scoped joinpoint ejpH() try { /*body*/ } handles E throws …; catch(E e) { … } void around() throws …: } call(ejpScope(ejpH)) } { try{ proceed(); } catch(E e) { … } } } class C { void m() throws … { A.ejpH(){ /*body*/ } } }
  • 35. Empirical Metrics  Coupling Between Modules (CBM)  Coupling on Intercepted Modules (CIM)  Lack of Cohesion of Operations (LCO)  Lines of Code (LOC) / Concern LOC (CLOC)  Number of Operations (NoO)  Concern Diffusion over Modules (CDoM)  Concern Diffusion over Operations (CDoO)  Concern Diffusion over Lines of Code (CDoLOC)  Reusable Operation Use Percentage (ROUP)
  • 36. Coupling Metrics  Coupling Between Modules (CBM)  Number of other modules referenced via field access or method call or EJP reference  Extended to include reference to EJP interfaces  [Chidamber, Kemerer 1994] class C { void m1(B var1, B var2) { A.ejpH(){ var1.m3(); } C.m2(); var2.m4(); CBM = 2 } (A and B) static void m2() { … } }
  • 38. Coupling Metrics  Coupling on Intercepted Modules (CIM)  # of modules explicitly named in pointcuts  [Ceccato, Tonella 2004] pointcut initScrGetResHdlr(): withincode( private void TemplateServlet. initScreens( ServletContext, CIM = 3 String)) && call(URL ServletContext .getResource(String));
  • 40. Cohesion Metric  Lack of Cohesion in Operations (LCO)  # of method pairs accessing different fields minus # of method pairs accessing common fields  Helps to measure commonality of purpose class C { Object f1, f2, f3; LCO = 2 void m1() { f1=…; } void m2() { f2=…; } void m3() { f3=…; } void m4() { f1=…; f2=…;} } Disjoint Pairs: m1-m2, m1-m3, m2-m3, m3-m4 Non-Disjoint Pairs: m1-m4, m2-m4
  • 41. Lack of Cohesion of Operations
  • 42. Size / Complexity Metrics  Lines of Code (LOC)  # of lines of code without whitespace / comments  Concern Lines of Code (CLOC)  # of lines of code required to implement the exception handling concern  Number of Operations (NoO)  Number of declared methods and advice
  • 46. Separation of Concern Metrics  Concern Diffusion over Modules (CDoM)  # of modules that implement a concern  … OR reference one that does  Concern Diffusion over Operations (CDoO)  # of operations that implement a concern  … OR reference one that does
  • 49. Separation of Concern Metrics  Concern Diffusion over Lines of Code  # of transitions between one concern to another class C { class C { void m() throws … { void m() throws … { try { A.ejpHandler() { /* /* body body */ */ } catch(E e) { … } } } } } }
  • 51. % of handlers implemented by abstract aspects or EJP library Exception Handler Reuse
  • 52. Reusable Exception Handler EJPs  Ignore exception  Print/log exception  Rethrow different exception or its cause  On exception set variable to value  Propagate exception if flagged 16 EJPs covered 74% of all handlers
  • 54. Cooperative AOP Can Help AspectJ: 39 AspectBase couplings EJPs: 11 AspectInterface, 15 BaseInterface
  • 55. Conclusions  Explicit Interfaces and EJP references:  Provided effective means for advice parameterization  Greatly increased aspect reusability  Must be carefully designed, ideally in advance  Greatest software quality achieved when using combination of obliviousness + EJPs
  • 56. Future Work  JSR-308 includes proposal for annotations on statements  Study interactions between obliviousness and software quality in the presence of multiple cross-cutting concerns kjhoffma@cs.purdue.edu peugster@cs.purdue.edu Download papers, slides, and compiler at http://www.kevinjhoffman.com/
  • 58. Addressing EJP Explicitness  Use EJPs only when appropriate  Design EJPs so that their presence is minimal Base Code EJP Interfaces Aspects  Use aspects to reference EJPs as appropriate  Aspect-oriented code editors  Fluid AOP [Hon / Kiczales]
  • 59. Empirical Metrics Formulated…  Coupling, Cohesion, Separation of Concerns  On the reuse and maintenance of Aspect-Oriented software: [Sant’Anna et. al. 2000]  AspectBase Code Coupling  Measuring the effects of software aspectization [Ceccato/Tonella 2004]  http://aopmetrics.tigris.org/
  • 60. Empirical Studies Emerging…  Separation of Concerns in Multi-agent Systems: An Empirical Study [2004]  Modularizing design patterns with aspects: a quantitative study [AOSD’05]  Composing design patterns: a scalability study of aspect- oriented programming [AOSD’06]  Exceptions and aspects: the devil is in the details [FSE’06]  On the impact of aspectual decompositions on design stability: An empirical study [ECOOP’07]  Towards Reusable Components with Aspects [ICSE’08]  Evolving Software Product Lines with Aspects [ICSE’08]
  • 61. Explicit Join Point Declarations abstract aspect TranConcern { scoped joinpoint void enterTrans(int isolation) throws TranException; } Keyword to Explicit Name to Associate Declare EJP with Abstract Semantics Optional Constraints Acting Explicit Value Modifiers Upon Base Code Parameterization
  • 62. Referencing EJPs in Base Code abstract aspect TranConcern { scoped joinpoint void enterTrans(int isolation) throws TranException; joinpoint int defIso() = 1; Some policy aspect could } implement/override this EJP void someMethod() throws TranException { TranConcern.enterTrans(TranConcern.defIso()) { //block of code } Reference to scoped EJP; Reference to } entire block of code is advised EJP in base code
  • 63. Advising EJPs in Aspects aspect TranConcernViaSomeLibrary { void around(int iso) throws TranException: call(ejpScope(TranConcern.enterTrans)) && args(iso) { TransContext t = …; t.beginTrans(); try { proceed(); /* calls original block of code */ t.commitTrans(); } catch(Throwable e) { t.abortTrans(); throw TranException(e); }}
  • 64. Advising EJPs in Aspects aspect BillingComponentsTranPolicy { int around(): call(ejp(TranConcern.defIso)) && within (com.me.billing.*) { return 4; } //use a higher isolation level in billing pkg } aspect ForceIsolationLevel { int around(): call(ejp(TranConcern.defIso)) && cflow(call(* CreditCard+.*(..))) { return 5; } //anytime the call stack includes a method } //from the CreditCard class use iso level 5