Download presentation
Presentation is loading. Please wait.
1
Abstraction and Dynamic Analysis for the Reconstruction of Scenario Diagrams Bas Cornelissen Leon Moonen Arie van Deursen
2
2 Introduction Scenario –event from the user’s perspective Scenario diagram –UML sequence diagram at the scenario level Long-term goal –e.g., conformance checking, design pattern detection, architecture reconstruction (?)
3
3 Challenges Static analysis –source code –independent of input –potentially covers all object interactions Dynamic analysis –execution traces –scenario- and input-driven –polymorphism: detection of late binding –merely applicable in “complete”, executable systems
4
4 Challenges Abstraction –typically, initial diagrams: are too large show too many details contain uninteresting interactions –this calls for abstraction mechanisms omit irrelevant messages and/or objects allow user to choose the level of detail
5
5 Method Reconstruction of scenario diagrams using JUnit and AspectJ 1.Scenario determination 2.Producing an execution trace 3.Abstraction 4.Visualization
6
6 Running example Pacman –25 Java classes –GUI –Large traces –Polymorphism
7
7 1. Scenario determination JUnit testcase –basically a use case –contains one or more scenarios public class PacmanTest extends TestCase { public PacmanTest(String arg0) { super(arg0); } public void testTopLevelAlphaOmega() throws InterruptedException { Pacman p = new Pacman(); p.start(); System.out.println("SCENARIO START"); p.up(); System.out.println("SCENARIO END"); p.quit(); p.exit(); }
8
8 2. Producing a trace Aspect for tracing methods and constructors –exclusion of certain classes and/or methods –distinction between run-time objects –at call sites, log: method/constructor ID caller + object ID callee + object ID method/constructor signature actual parameters METH 533: Pacman [1] :: Engine [2] :: public synchronized void Engine.movePlayer(int, int) :: 0, -1
9
9 3. Abstraction Compression –summarize recurring messages and patterns –requires pattern recognition –post-mortem Pruning –hide uninteresting interactions (and objects) –define minimum and maximum stack depths –both at the tracing and the visualization stage
10
10 4. Visualization GNU plotutils package –pic2plot –library containing pic macros for seq. diagrams –Perl script to create pic programs from traces object(Pacman1,"Pacman1"); object(Engine2,"Engine2"); object(Game3,"Game3");... step(); active(Pacman1); message(Pacman1,Engine2,"movePlayer(int, int)"); active(Engine2); message(Engine2,Engine2,"inPlayingState()"); message(Engine2,Game3,"initialized()");...
11
11 Example (1) Compression
12
12 Example (2) Pruning
13
13 Example (3)
14
14 Example (4)
15
15 Conclusions (1) JUnit testcases –enable scenario diagram reconstruction for both complete systems and incomplete systems/modules AspectJ –flexible: allows for (not) tracing specific components and/or messages –distinguishes between run-time objects
16
16 Conclusions (2) Effective abstraction mechanisms –human-readable, high-level model is easily obtained –though omission of messages at deep stacklevels may be infeasible Better visualization is needed –interactive –e.g., zooming, expanding
17
17 Questions Fire at will!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.