the development speed for crosscutting code an empirical
play

the Development Speed for Crosscutting Code? An Empirical Study - PowerPoint PPT Presentation

Does Aspect-Oriented Programming Increase the Development Speed for Crosscutting Code? An Empirical Study Stefan Hanenberg, Sebastian Kleinschmager, Manuel Josupeit-Walter University of Duisburg-Essen, 2009 Presenter: Olivier Clerc ETH Zrich


  1. Does Aspect-Oriented Programming Increase the Development Speed for Crosscutting Code? An Empirical Study Stefan Hanenberg, Sebastian Kleinschmager, Manuel Josupeit-Walter University of Duisburg-Essen, 2009 Presenter: Olivier Clerc ETH Zürich 1

  2. Logging void foo() { bar(); } void bar() { baz(); } void baz() { System.out.println(“Hello, world!“); }  Extend the program such that each method call is written to a log 2

  3. OOP Solution void foo() { Logger.log("foo"); bar(); } void bar() { Logger.log("bar"); baz(); } void baz() { Logger.log("baz"); System.out.println(“Hello, world!“); }  Add logging instruction at beginning of each method  Tedious if number of methods is large  The logging behavior is dependent on the program 3

  4. Cross-cutting Concerns  Logging is a prime example of a cross-cutting concern  Definition: A behavior that affects multiple modules in traditional OOP 4

  5. Aspect-Oriented Programming (AOP)  Programming paradigm that addresses cross- cutting concerns  Separation of a software system‘s cross- cutting concerns from its core logic  Aspect = a cross-cutting concern  Base code = the core logic (traditional OOP)  Program = base code + set of aspects 5

  6. AOP Solution public aspect LoggerAspect { Pointcut: „WHEN?“ pointcut methodInvocation() : execution(* *(..)); before() : methodInvocation() { MethodSignature signature = (MethodSignature) thisJoinPoint.getSignature(); Logger.log(signature.getMethod().getName()); } Advice: „WHAT?“ }  Logging is represented as a new aspect  Completely decoupled from the rest  The aspect can be reused for any other OO program 6

  7. Intent of the Paper  Proponents of AOP claim...  It provides better modularization  It is more readable  It is more maintainable (suggested by another study)  What about the development time?  The paper tries to answer: “Under what circumstances does AOP reduce the development time ?“  Important: this question is only asked for cross-cutting concerns 7

  8. Assumption of the Authors  Assumption: “The more code targets a cross -cutting concern affects, the more it pays out to use AOP“  Rationale: For logging only 3 methods it is easier to simply add 3 lines of code, instead of writing an aspect. 8

  9. Experimental Setup  1 target application (small game of 9 classes)  20 subjects (students with 1.5h AOP experience)  9 tasks (extensions) to be implemented  To be done using both AOP (AspectJ) and OOP (Java)  Development time for a task was measured from the first code change until all test cases pass 9

  10. Tasks Task # code Code targets sim. ≠ 1. Logging 110 ≠ 36 2. Parameter Null = 3. Synchronization 52 = 4. Player Check 4 = 5. Notify Observers 19 = 6. Observers Null 15 ≠ 7. Refresh Constraint 8 ≠ 8. Label Value Check 6 = 9. Level Check 7 10

  11. Variance Analysis “What causes the different development times?“  The development time potentially depends on two factors :  the task  the language • Result of 2-factor ANOVA ( an alysis o f va riances) :  The task has an important effect  The language has an effect  The effect of the language depends on the task (interaction effect) 11

  12. Variance Analysis (2) Effect F value p value Main effect of task 55.02 ~0 Main effect of language 13.75 0.001 Interaction effect of task and language 9.85 ~0 12

  13. Equality of Development Times “For what tasks does the choice of language result in different development times?“  For each task there are 20 samples of the AO and OO development time  A Wilcoxon test was performed to check which of the following hypotheses hold:  H 0 : the development times for AO and OO are equal  H 1 : they are not equal 13

  14. Task # code Code targets sim. ≠ 1. Logging 110 ≠ 2. Parameter Null 36 = 3. Synchronization 52 = 4. Player Check 4 5. Notify = 19 Observers = 6. Observers Null 15 7. Refresh ≠ 8 Constraint 8. Label Value ≠ 6 Check = 9. Level Check 7 n/a n/a All tasks as one 14

  15. Task # code Code All targets sim. devs ≠ + 1. Logging 110 ≠ + 2. Parameter Null 36 = 3. Synchronization 52 0 = - 4. Player Check 4 5. Notify = - 19 Observers = - 6. Observers Null 15 7. Refresh ≠ - 8 Constraint 8. Label Value ≠ - 6 Check = 9. Level Check - 7 n/a n/a - All tasks as one 15

  16. Task # code Code All Fast Slow targets sim. devs OO OO devs devs ≠ + + 1. Logging 110 0 ≠ + 2. Parameter Null 36 0 0 = - 3. Synchronization 0 0 52 = - - - 4. Player Check 4 5. Notify = - - - 19 Observers = - - - 6. Observers Null 15 7. Refresh ≠ - - - 8 Constraint 8. Label Value ≠ - - - 6 Check = 9. Level Check - - - 7 n/a n/a - All tasks as one n/a n/a 16

  17. Task # code Code All Fast Slow Fast Slow targets sim. devs OO OO AO AO devs devs devs devs ≠ + + + 1. Logging 110 0 0 ≠ + 2. Parameter Null 36 0 0 0 0 = - - 3. Synchronization 0 0 0 52 = - - - - - 4. Player Check 4 5. Notify = - - - - - 19 Observers = - - - - - 6. Observers Null 15 7. Refresh ≠ - - - - - 8 Constraint 8. Label Value ≠ - - - - - 6 Check = - 9. Level Check - - - 0 7 n/a n/a - All tasks as one n/a n/a n/a n/a 17

  18. Threats to Validity  Authors:  The experiment was done in different sessions  Not all received exactly the same tutorial  Learning curve of subjects ignored  Are the tasks representative?  My opinion:  Are the statistics expressive? (only 20 samples)  Subjects were all AOP novices (only 1.5h of learning)  What about other AOP languages apart from AspectJ? 18

  19. Conclusion “Under what circumstances does AOP reduce the development time ?“ 1. if the developers are experienced ; 2. if the number of code targets is large (≥36); 3. if the OOP code snippets to be inserted are different from each other. 19

  20. Questions? 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend