1 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Debugging Support for Aspect-Oriented Program Using Program Slicing and Call Graph Takashi Ishio, Shinji Kusumoto, Katsuro Inoue Osaka University {t-isio, kusumoto, inoue}@ist.osaka- u.ac.jp
32
Embed
Debugging Support for Aspect-Oriented Program Using Program Slicing and Call Graph
Debugging Support for Aspect-Oriented Program Using Program Slicing and Call Graph. Takashi Ishio, Shinji Kusumoto, Katsuro Inoue Osaka University {t-isio, kusumoto, inoue}@ist.osaka-u.ac.jp. Overview. Aspect-Oriented Programming AOP’s advantage and disadvantages - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Debugging Support for Aspect-Oriented Program
Using Program Slicing and Call Graph
Takashi Ishio, Shinji Kusumoto, Katsuro Inoue
Osaka University
{t-isio, kusumoto, inoue}@ist.osaka-u.ac.jp
2Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Overview
Aspect-Oriented ProgrammingAOP’s advantage and disadvantagesDifficulties in debugging AOP program
Proposed MethodProgram Slicing extended for AOPLoop Detection based on Call Graph
(not included in this presentation)
ImplementationEvaluationConclusion
3Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Aspect-Oriented Programming
Key Idea: Separation of crosscutting concerns
In OOP, programmers cannot encapsulate crosscutting concerns:
Code for object interaction is scattered to related classes.
It is hard to manage scattered code.
In AOP: A crosscutting concern == An aspectWhen a concern is changed, programmers modify one aspect instead of related classes.
4Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
AspectJ, an AOP extension for Java
AspectJ: an AOP extension for JavaAn aspect is defined as a set of advices.Advice: a procedure + a condition when the procedure is executed.A condition = before or after specific events, or instead of the events (around).
Around advice uses proceed keyword to execute the original event.Events are specified by Pointcut Designators (PCDs) including:
– Method Call and Execution– Field Assignment and Reference– Exception Handling
A procedure is written in plain Java with thisJoinPoint object representing the event information.
5Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Simple Example of Aspectaspect LoggingExample {
after(): execution(void *.foo(int)) {
Logger.logs(thisJoinPoint.getSignature()); } }
An advice knows when the advice is executed.
Call statements in classes are removed.
C.foo(int v)
B.foo(int v)
A.foo(int v)
Logging Class Logging Aspect
C.foo(int v)
B.foo(int v)
A.foo(int v)Logger.logs(“A.foo”);
when a method is executed, logger.logs(v) is called.
Logger.logs(“C.foo”);
6Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Advantages of AOP
AOP improves:Maintainability
Programmers change one aspect instead of multiple classses.
ReusabilityProgrammers can reuse classes and aspects independently.
– Reuse classes without aspect, or– Reuse aspects for other classes
7Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Disadvantages of AOP
AOP is useful, but ... several drawbacks exist.
Fault localization is difficult since:A programmer needs to investigate related classes and aspects to understand the system behavior.
When a class is affected by several aspects, the result is hard to predict.
e.g. Logging + Transaction ???
A transaction process is logged, or
Logging is transactional, or ... ?
The result depends on the definition of aspects, or compiler/interpreter implementation
8Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
PDG construction– [Compile]-[Rebuild All] constructs PDG– A call graph is also constructed.– A method call loop including advices is recorded as “infinite loop
candidates”.
Slice Calculation– is started by a button of a tool bar – calculates a slice and indicates a slice on the text editor.
Dynamic Analysis is not integerated to IDE.Dynamic analysis code is also inserted using AspectJ.A programmer need to execute a program once.
16Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Screenshot
17Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
ExperimentDebugging Experiment
We have 12 students debug an AspectJ program.All students have used Java, but not AspectJ.devided into two groups;
a group working with a program slice, another without the slice
Environment: Eclipse 2.1 + AspectJ Development Tools
Procedure:A lecture for using EclipseDebugging a Java program using Eclipse. (PRE1)A lecture for AspectJWrite an AspectJ program using Eclipse. (PRE2)Debugging a AspectJ program using Eclipse. (DEBUG)
18Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Debugged ProgramAn AspectJ Program “Eval Expression”
Input: an expression represented by a graph.An evaluation = graph traversalOutput: (* (+ 2 3) (+ 2 3) ) = 25