Download presentation
Presentation is loading. Please wait.
Published byJustin Alexander Modified over 11 years ago
1
Story Driven Modeling – A Practical Guide to Model Driven Software Development Albert Zündorf, University of Kassel, Germany Tutorial
2
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 2 Content 1. Overview 2. The running example: Ludo 3. Use case description 4. Object oriented analysis with story boards 5. Test derivation 6. Derivation of design and implementation 7. Validation
3
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 3 Overview Steps: m Textual use case description m Story Boarding (OOA) (Test specification) m Class diagram derivation (OOD) m Behavior derivation (Coding) m Code generation m Validation (Testing) Features: m Use Case Driven m Model Driven m Iterative m Test Driven Development Story Driven Modeling:
4
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 4 2. The running example: Ludo
5
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 5 3. Use case description Requirements elicitation as usual: m Use case diagrams for overview
6
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 6 3. Use case description (cont.) Textual scenario descriptions: m focus on scenarios m several scenarios per use case m focus on one example situation at a time m use concrete names Use case _ _ _ _ _ _, _ _ _ _ _ _ : Start situation: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Invocation: _ _ _ _ _ _ _ _ _ _ _ _ _ Step 1: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Step 2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Result situation: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 7 Our experience: m this does not work ! m very high skills required m fruitless discussion on details m class diagrams are not appropriate for the analysis and discussion of behavior 4. Object oriented analysis with story boards Usual text book approach: m analyse the text scenarios m nouns become classes m verbs become methods or associations m...
8
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 8 4. Object oriented analysis with story boards (cont.) SDM approach: m analyse the text scenarios m nouns become objects m verbs become method invocations or links m... Start Situation: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
9
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 9 4. Object oriented analysis with story boards (cont.2) m use case execution is modeled by one method invocation m drawn as collaboration message m multiple scenarios for one use case call the same method (but in different situations) m this method implements the use case m use case method mapping enables tracebility m step descriptions may become implementation comments Actor step 1: _ _ _ _ _ _ _ _ _ _ _ _ 1: _ _ _ _ _ _ _ _
10
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 10 4. Object oriented analysis with story boards (cont.3) use case method mapping m uc1 > uc2 method uc1() may call method uc2() m uc1 > uc2 uc1() always calls uc2() m uc2 > uc1 uc1() provides extension points / call backs. uc2() may subscribe for such a call back
11
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 11 4. Object oriented analysis with story boards (cont.4) Outlining method behavior in concrete example situations: Step 1: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ m > and > markers m := attribute assignments m recurring objects without class name first time on stage with class name (change of perspective) m collaboration messages m alternatively sequence diagrams tom theDie counter1 f1 f2 :Field v == 3 v := 2 counters at other :Counter at next die «destroy» «create» 1: go()
12
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 12 4. Object oriented analysis with story boards (cont.5) Result situation: m models resulting object structure m used for testing Result Situation: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tom theDie counter1 f4 v == 0 counters at die
13
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 13 6a Derivation of Class Diagrams m Classes m Associations m Attribute declarations m Method declarations Collect the types from the story boards:
14
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 14 6a Derivation of Class Diagrams (cont.) m Class diagram derivation is straight forward m Semi-automatic tool support by Fujaba m Intermediate story board step results in much better domain level class diagrams m code generation for class diagrams m story boards are appropriate for the analysis and discussion of behavior m story boards also useful during refinement and coding m story boards may serve as test specifications m story boards may drive the implementation
15
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 15 5. Test Derivation m Scenarios JUnit Tests m start situation setup code m invocation invocation m result situation code that checks object structure equivalence
16
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 16 5. Test Derivation (cont.) m Scenarios JUnit Tests, start situation setup code Start Situation: Tom rolled a 3 and selects counter 1 for moving theDie :Die f2 :Field v == 3 counters at next die f3 :Field next f4 :Field next class TestMoveUsual implements TestCase { private Player tom; private Die theDie; private Counter counter1;... void setUp () { tom = new Player (); theDie = new Die (); theDie.setV (3) tom.setDie (theDie); counter1 = new Counter (); tom.addToCounters (counter1);... tom :Player counter1 :Counter f1 :Field tom theDie counter1 f2 f1 f3 f4 :TestMoveUsual
17
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 17 5. Test Derivation (cont.2) m Scenarios JUnit Tests, start situation setup code Invocation: counter 1 is moved class TestMoveUsual implements TestCase {... void testMoveUsual () { this.counter1.move();... counter1 1: move ()
18
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 18 5. Test Derivation (cont.3) m Scenarios JUnit Tests, start situation setup code class TestMoveUsual implements TestCase { void testMoveUsual () { this.counter1.move(); assertTrue (tom.getDie() == theDie); assertTrue (theDie.getV() == 0); assertTrue (counter1.getPlayer () == tom); assertTrue (counter.getAt () == f4); } Result Situation: the die is counted down to zero and counter 1 reached field 4 tom theDie counter1 f4 v == 0 counters at die
19
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 19 5. Test Derivation (cont.4) m more complex result situations work, too (see later) m start situation, invocation, result situation JUnit tests m steps may be exploited, too, cf. [SCESM05] m analysis scenarios tests m test driven software development
20
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 20 6b Derivation of the Implementation m Dobs + BeanShell + Coding Tool Demo or m combine story boards to rule diagrams [SCESM04] m assign execution semantics m code generation
21
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 21 6b Derivation of the Implementation (cont.) this pos myPlayer theDie 2 at next Main Memory ObjectsRule Diagram / Program
22
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 22 6b Derivation of the Implementation (cont.2) 2 1 at this posnext myPlayer theDie at Main Memory ObjectsRule Diagram / Program
23
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 23 6b Derivation of the Implementation (cont.3) 1 0 this posnext myPlayer theDie at Main Memory ObjectsRule Diagram / Program
24
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 24 6b Derivation of the Implementation (cont.4) 0 this pos at Main Memory ObjectsRule Diagram / Program
25
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 25 6b Derivation of the Implementation (cont.5) 0 pos at this otherCounter otherPlayermyPlayer Main Memory ObjectsRule Diagram / Program
26
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 26 6b Derivation of the Implementation (cont.6) class Counter { public void move () { Position pos;... while (sdmSuccess) { try { sdmSuccess = false; pos = this.getAt (); JavaSDM.ensure (pos != null); next = pos.getNext (); JavaSDM.ensure (next != null); myPlayer = this.getOwner (); JavaSDM.ensure (myPlayer != null); theDie = myPlayer.getDie (); JavaSDM.ensure (theDie != null); JavaSDM.ensure (theDie.getV() > 0); sdmSuccess = true; this.setAt (null); this.setAt (next); theDie.setV(theDie.getV() - 1); } catch (SDMException e) {} } // while
27
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 27 6b Derivation of the Implementation (cont.7) this looser lostCounter noPos lhome at
28
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 28 6b Derivation of the Implementation (cont.8) class Game { public void collectThrownCounters () {... Iterator looserIter = this.iteratorOfPlayers(); while (!sdmSuccess && looserIter.hasNext()) { try { sdmSuccess = false; looser = looserIter.next (); lhome = looser.getHome (); JavaSDM.ensure (lhome != null); countersIter = looser.iteratorOfCounters (); while (!sdmSuccess && countersIter.hasNext()) { try { lostCounter = countersIter.next (); JavaSDM.ensure (lostCounter.getAt() == null); sdmSuccess = true; lostCounter.setAt (lhome); } catch (SDMException e) {} } // while } catch (SDMException e) {} } // while
29
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 29 6b Derivation of the Implementation (cont.9) m manual derivation of rule diagrams from stories m brain required m systematic guide lines provided e.g. in [SCESM04] m automatic code generation [GraGra]
30
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 30 7. Validation m JUnit Tests Implementation realizes the Scenarios m Coverage analysis Implementation does additional things l unnecessary code, or l missing scenarios m Debugging aids Tool Demo
31
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 31 Summary Story Driven Modeling m model level analysis with story boards m model level tests m model level implementation with rule diagrams m code generation m model level testing / debugging www.fujaba.dewww.fujaba.de zuendorf@uni-kassel.de
32
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 32 References m [SCESM04] I. Diethelm, L. Geiger, A. Zündorf: Systematic Story Driven Modeling, a case study; Workshop on Scenarios and state machines: models, algorithms, and tools; ICSE 2004, Edinburgh, Scottland, May 24 – 28 (2004). m [SCESM05] Leif Geiger, Albert Zündorf: Story Driven Testing; in proc. 4th International Workshop on Scenarios and State Machines: Models, Algorithms and Tools (SCESM'05) ICSE 2005 Workshop m [GraGra] T.Fischer, J.Niere, L.Torunski, A.Zündorf: Story Diagrams: A new Graph Grammar Language based in the Unified Modeling Language; in Proc. of TAGT '98 - 6th International Workshop on Theory and Application of Graph Transformation. Technical Report tr-ri-98-201, University of Paderborn; (1999)
33
Fujaba Tutorial Story Driven Modeling © 2005 Albert Zündorf, University of Kassel 33 Addendum A: Story Pattern Elements:
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.