Transitioning From Software Requirements Models to Design Models























- Slides: 23
Transitioning From Software Requirements Models to Design Models PI: Jon Whittle QSS Group Inc.
Use case simulation – – customers Complexity Validation Evolution Requirements/Design gap Simulation of use cases (scenarios) Semi-automatic design transformation designer/architect programmer simulation Goal: Cost-effective way of simulating requirements • automatic transformation to executable form • executable form can be reused in design
Main Idea Scenarios State Machines Code Test Cases etc. . Requirements Validation Many good reasons for working with scenarios • walkthrough software artifacts • analysis/validation • test case generation • state machine generation Missing link: how to develop an appropriate set of scenarios? • synthesis requires completeness • test case generation requires coverage • requirements validation requires coverage
Overview of Research SCASP (Scenario Creation and Simulation Process) Write requirements Itemized List Write use cases Prioritize use cases Write nominal scenarios Identify relationships Refine/ Generalize scenarios Transform to state machines UML 2. 0 For risk, Sequence importance & Diagrams metric calculation Write down what you can preempts, parallel, crosscuts etc. Based on UML, but (mostly) language-independent Metrics measure completeness/complexity systematic guidelines synthesis algorithm
Illustrative Example • Autonomous agents bid for orders from clients – May bid for any number of orders simultaneously – Broker assigns orders – Clients pay controller who in turn pays agents This talk: agent=rail shuttle client=passenger Controller Broker
1. Write Requirements R 1 Shuttles traveling on sections of tracks that are disrupted are not affected. R 2 Shuttles not traveling on a section of tracks that become disrupted will not be able to use it. R 3 All shuttles will be informed of a disruption and its duration. R 4 a Orders are made known to all shuttles by a broker. R 4 b Any shuttle can make an offer within a certain period of time R 4 c The shuttle making the lowest offer will receive the assignment R 4 d In the event of two equal offers, the assignment goes to the shuttle that made the first offer R 5 Orders will be paid for by passengers either by credit card or invoice R 6 a Every shuttle has a maximum capacity determined at the start of the simulation R 6 b A shuttle can transport more than one order at a time as long as the orders do not exceed the maximum capacity R 6 c The number of orders assigned (not necessarily loaded) to a shuttle at any given time is not limited R 7 a To complete an order, a shuttle has to travel to the start station, load the order and proceed to the destination station to unload R 7 b R 7 a has to be completed within a deadline or a penalty will be levied. R 7 c Loading/unloading at intermediate stations (for the same order) is not permitted R 8 A shuttle traveling on a section of tracks can neither change direction nor choose another destination. A travel decision is only possible at a station before the journey has begun. R 9 a In the beginning, every shuttle will receive a fixed capital R 9 b Payment to a shuttle occurs after an order is delivered an invoice is sent to the banking agent R 9 c If the order specified credit card payment, money is transferred to the shuttle immediately. If the payment was invoicing then the transfer will be delayed for a certain amount of time R 10 Shuttles pay their toll when a station is reached R 11 If a shuttle exceeds a certain distance, maintenance will be carried out at the next station automatically and the shuttle will not be able to leave the station until maintenance is finished.
2. Write Use Cases
3. Prioritize Use Cases Use case Priority Affected Shuttle 5 Carry out order 9 Connection disruption 5 Initialization 5 Maintenance 5 Make a bid 10 Make payment 1 Pay toll 3 Pay penalty 4 Receive payment 4 Retirement 5 Successful completion 8 Unaffected shuttle 1 Unsuccessful Completion 8
4. Write nominal scenarios Nominal scenario Non-nominal scenario • Nominal scenario: typical or important functionality • Non-nominal scenario: unusual or unexpected behavior “write down what you can!”
Nominal Scenario: bidding
5. Identify Relationships 5. 1 Within use cases: S is a continuation of T S is an alternative to T S may execute in parallel with T S may preempt T S may suspend T S may never happen during R S is an exception handler for T Multiple instances of S may execute at once S crosscuts R. <<neg>> * Successful completion Move to intermediate station
5. Identify Relationships 5. 2 Between use cases: * {. . . . } *
6. Generalize/Refine Nominal Scenarios • Series of issues based on common generalization/refinement strategies. – May be language dependent or independent Issue Context A generalization Component, message or /refinement strategy to look scenario for Question Action Alternatives What to look for? What action to take? Alternative actions
Issues (so far) Context: component: type If no: consider a refactoring of the type model to introduce sub. Does the scenario apply to all 1. 1 components for those to which the components of type? Issue number Question Action If all: replace component with a scenario applies. Should a message sent to 1. 1 Does the scenario apply to all components of multiobject If no: consider representing a refactoring of theall type model to component be sent to all type? introduce sub-components forand thosemake to which components of type 1. 2 components of type or just the scenario applies. the message a universal message If all: replace component with a one? Should a message received by 1. 2 Should a message sent to component be sent If all: to replace component with a multiobject all components. multiobject representing all to all components of type or just representing all components of type and component be received by all components of type and make 1. 3 one? make the message a universal message sent components of type or just to all components. the message a universal message one? bycomponent all components. 1. 3 Should a message received by component be received If all: replace with a multiobject Analogreceived of 1. 2 byfor messages sent to at least one of a set of components all components of type representing all components of type andof 1. 4 a certain type. or just one? make the message a universal message received by all components. 1. 4 1. 5 Analog of of 1. 2 for messages sent to at leastreceived one of a set of of aone certainof type. a set of Analog 1. 3 for messages bycomponents at least components of a certain type. Analog of 1. 3 for messages received by at least one of a set of components of a certain type.
Context: message 2. 1 2. 2 2. 3 2. 4 2. 5 Could message be replaced with another message without changing the behavior of the scenario? If yes: replace message with a combined fragment with interaction operator alt and the two alternative messages as operands. Could message be sent from of or bemessage received by a different If yes: replace message with a combined fragment with interaction Can the ordering be component without changing the behavior of the scenario? operator alt and message with its alternative sending or receiving changed? In particular, could the components as operands. Is message aof choice point? – i. e. , could an alternative If yes: encapsulate the existing and new behaviors in operands of a ordering message and its message have appeared at this point that would change the with an alt operator, and introduce for thethe Ifcombined yes: iffragment introduce coregions toguards relax following behavior? operands necessary. immediate neighbors be altered? scenario ordering constraints. Can thethe ordering of message be changed? In particular, could If yes: introduce coregions to relax the scenario ordering constraints. Could ordering of message the ordering of message and its immediate neighbors be the ordering of message and be its distant andaltered? its Could distant neighbors be altered? Is message optional (or part of an optional sequence)? If yes: encapsulate the optional elements in a combined fragment with operator opt. 2. 6 Does message have a guard? If yes: introduce alternatives when the guard is not satisfied (using alt). 2. 7 Can message fail? If yes: capture the failure handler as a separate interaction diagram referred to (using ref) in the main diagram and use an alt operator to capture the alternative when the message fails. 2. 8 Could message overlap its neighbors? If yes: redraw the message. If necessary, add timing mark constraints. Arethere undesired implied 2. 9 there alternatives for the message that are invalid? scenarios? – e. g. , caused by 2. 10 Are there opportunities for introducing concurrency? messages on depend different lifelines 2. 11 Does message really on all its predecessors? 3. 1 Context: scenariothat appear to be ordered based on their graphical depiction but 3. 1 thereordered undesired implied scenarios? – e. g. , caused by are. Arenot according to the messages on different lifelines that appear to be ordered sequence diagram semantics. based on their graphical depiction but are not ordered according to the sequence diagram semantics. If yes: introduce combined fragments with a neg interaction operator. If. If yes: introduce an explicit introduce combined fragments with the par operator. “handshake” message between If no: extract the dependent messages into a separate scenario. the two lifelines that forces the sequence diagram semantics to constrain the If yes: introduce an message between the two ordering ofexplicit the“handshake” messages. lifelines that forces the sequence diagram semantics to constrain the ordering of the messages.
Example 2. 11 Does message really depend on all its predecessors? If no: extract the dependent messages into a separate scenario. Scenario shows just one example, therefore factor out any “incidental” dependencies Crew Ground detect. Conflict notify Crew Ground detect. Conflict Ground notify detect. Conflict Split into two scenarios to allow other orderings
Bidding Example: Before 1. 2 Issue Description 1. 2 Scenario shows only 2 shuttle instances. Generalize using a multiobject and merge messages 2 and 3 into a universal message. Note: there needs to be a single identified instance of Shuttle to receive message 10. Scenario shows only 2 shuttle instances. Generalize using a multiobject and merge messages 2 and 3 into a 1. 5 universal message. Note: there Merge messages 4 and 6 into an existential message needs to be a single identified instance of Shuttle to 11 isreceive message 10. 2. 3 Alternative to message reject. Offer. Alternatives to 9 are no. Bids and Bids. Are. Equal. 1. 5 2. 11 2. 4 Messages 2, 3 can be in any order. As can 4, 6 and 5, 7 2. 5 Messages 4, 5 can be marked as optional as only one shuttle may decide to bid Message 9 is optional (there may be only one bid) Message 11 is optional as the winning shuttle may not respond to the offer Merge messages 4 and 6 into an existential message 2. 7 There may be communication failures 2. 9 The broker should not accept the highest bid 2. 10 The order/bid for each shuttle can be split into parallel fragments 2. 11 Message 4 does not depend on 3 (this one is ok because of the partial order semantics). Message 6 does not depend on message 2. Messages 6, 7 do not depend on message 5. Message 8 does not depend on messages 4 -7. Message 11 does not depend on messages 4 and 5.
Bidding Example: Before Issue Description 1. 2 Scenario shows only 2 shuttle instances. Generalize using a multiobject and merge messages 2 and 3 into a universal message. Note: there needs to be a single identified instance of Shuttle to receive message 10. 1. 5 Merge messages 4 and 6 into an existential message 2. 3 Alternative to message 11 is reject. Offer. Alternatives to 9 are no. Bids and Bids. Are. Equal. 2. 4 Messages 2, 3 can be in any order. As can 4, 6 and 5, 7 2. 5 Messages 4, 5 can be marked as optional as only one shuttle may decide to bid Message 9 is optional (there may be only one bid) Message 11 is optional as the winning shuttle may not respond to the offer 2. 7 There may be communication failures 2. 9 The broker should not accept the highest bid 2. 10 The order/bid for each shuttle can be split into parallel fragments 2. 11 Message 4 does not depend on 3 (this one is ok because of the partial order semantics). Message 6 does not depend on message 2. Messages 6, 7 do not depend on message 5. Message 8 does not depend on messages 4 -7. Message 11 does not depend on messages 4 and 5.
Bidding Example: After : Controller : Shuttle <<multiobject>> : Controller : Broker 1: offer. Time. Ends 1: new. Order X all 2: choose. Lowest. Bid 2: new. Order 3: grant. Offer exist alt 3: make. Bid 4: accept. Offer 5: end. Order 4: make. Bid 5: refuse. Offer S 1 6: rechoose X S 2 preempts S 1 S 2
7. Transform to State machines ? pick. Up. Passengers ? move. To. Station(start) timeout ? move. To. Station(end) ? request. Route ? request. Payment please. Wait ? drop. Off. Passengers send. Route make. Payment timeout ? request. Route ? pick. Up. Passengers ? move. To. Station(start) send. Route ? move. To. Station(end) ERROR ? request. Payment ? drop. Off. Passengers
“State of Play” SCASP (Scenario Creation and Simulation Process) Write requirements Write use cases Prioritize use cases Write nominal scenarios Identify relationships Metrics TRL 5 Refine/ Generalize scenarios Transform to state machines
Metrics actual complexity nonzero priority & nonzero complexity nonzero priority expected complexity
Accomplishments • SCASP: – Defined SCASP and evaluated on multiple case studies • • CTAS weather update Motorola call setup sequence Univ. Paderborn shuttle system CTAS trajectory up/downlink) – Techniques for separation of concerns (aspects) • forthcoming papers in Requirements Engineering ’ 04 and IEE Software – Synthesis: • outlined new algorithm for synthesizing state machines from scenarios – Metrics • defined metrics for evaluating completeness/complexity of process • Tool support (IBM Rational Rose plug-in): – Simple version of algorithm – plug-in for reusable patterns (including use case aspects) – Integrated state machine simulator from Teknowledge Corp. (Alexander Egyed) • Customer interest: – NASA CTAS – Motorola