250 likes | 383 Views
BVUML B ehavioral V alidation of UML Diagrams. Boris Litvak Shmuel Tyszberowicz Amiram Yehudai. Project Goals. Checking consistency of dynamic UML diagrams Targeted for software designers: Have no knowledge in formal logic Output needs to be easily understood Based on UML standard 1.4
E N D
BVUMLBehavioral Validation of UMLDiagrams Boris Litvak Shmuel Tyszberowicz Amiram Yehudai SEFM 2003
Project Goals • Checking consistency of dynamic UML diagrams • Targeted for software designers: • Have no knowledge in formal logic • Output needs to be easily understood • Based on UML standard 1.4 • Pre-implementation stage solution
UML • Unified Modeling Language • Sequence diagram • Object lifelines and inter-object messages • Usually describes some scenario • State diagram • Single object behavior • States and state transitions • Checking consistency of dynamic UML diagrams
Description • Algorithmic approach • Key concept: the “current object state”is the conjunction of the states in which the control resides • The basic idea: • The incoming and the outgoing messages from an object in the sequence diagram are checked against the current object state in the state diagram See UML 1.4 standard FOR MORE INFO...
Description • Implementation problems: • Need to define correspondence between diagrams (e.g. terminology) • Complex State diagrams • Features that originated in activity diagrams are the hardest to handle • We even use simplified diagrams in this presentation, for clarity • However, BVUML output was run on the original See UML 1.4 standard FOR MORE INFO...
Composite states Concurrent composite states Guards Choice states Fork states Join states Exiting composite states History states Transient and persistent states Completion transitions … Complex state diagrams
C&CSystem: Target update example
Terminology • Leg • Depicted as an arrow in either sequence or state diagram • Sequence and state transitions • In state diagram usually between two persistent states • In sequence diagram usually between two incoming messages • Common transition concept • Suitable transitions • State transitions that are equal to sequence transitions • Current object state • Conjunction of state diagram states which contains all the data about the object
Running (1.7.1) Trigger=FinishedRequest Legs=[Leg(1.7.2): {action=SendConfirmation, guard=AnswerConfirmed}, Leg(1.7.3): {action=WriteLog, guard=WriteLog}] : | Running top with currentStates[top.Stage2.ContactIntelligence] : | Running top.Stage2.ContactIntelligence (externally) : | Running Trigger=FinishedRequest Leg: {} to top.Stage2.Answered. : | Trying Leg: {action=SendConfirmation, guard=AnswerConfirmed} to top.Stage2.WillingToAnswer ... success. | Trying Leg: {guard=NoAnswer} to top.Stage2.EndIntUpdate ... failure. | Trying Leg: {guard=NoLogWrite} to top.Stage2.EndIntUpdate ... failure. | Trying Leg: {action=WriteLog, guard=WriteLog} to top.Stage2.EndIntUpdate ... success. Complex trace example • Single transition: | Running (1.7.1) Trigger=FinishedRequest Legs=[Leg(1.7.2): {action=SendConfirmation, guard=AnswerConfirmed}, Leg(1.7.3): {action=WriteLog, guard=WriteLog}] : | Running top with currentStates[top.Stage2.ContactIntelligence] : | Running top.Stage2.ContactIntelligence (externally) : | Running Trigger=FinishedRequest Leg: {} to top.Stage2.Answered. :
Complex trace example (cont.) | Trying Leg: {action=SendConfirmation, guard=AnswerConfirmed} to top.Stage2.WillingToAnswer ... success. | Trying Leg: {guard=NoAnswer} to top.Stage2.EndIntUpdate ... failure. | Trying Leg: {guard=NoLogWrite} to top.Stage2.EndIntUpdate ... failure. | Trying Leg: {action=WriteLog, guard=WriteLog} to top.Stage2.EndIntUpdate ... success.
Inconsistency: An example • Using a cellular phone scenario: • Dial some digits • There is an incoming call • Pressing “Send” must answer the call FOR MORE INFO... Example taken from Robert C. Martin’s UML tutorial
Inconsistency: An example (cont.) • In leg #6 (send button pressed), the sequence diagram designer intended to make a call (ConnectAction is invoked) • In the state diagram, when a call is answered at the AnswerWait state, AnswerAction is expected
BVUML run trace … | Running (005) Trigger=IncomingCall Legs=[] : | Running top with currentStates[top.Idle] : | Running top.Idle (externally) : | Running Trigger=IncomingCall Leg: {} to top.AnswerWait. ... success | Running Trigger=Send Leg: {action=ConnectAction} to top.OnLineWait. ... failure | Running Trigger=Digit Leg: {} to top.Idle. ... failure
BVUML run trace (continued) | Running (006) Trigger=Send Legs=[Leg(007): {action=ConnectAction}] : | Running top with currentStates[top.AnswerWait] : | Running top.AnswerWait (externally) : | Running Trigger=Send Leg: {action=AnswerAction} to top.OnLineWait. ... failure | Running Trigger=Digit Leg: {} to top.AnswerWait. ... failure
Algorithm (top) view • For each object in the sequence diagram iterate over its sequence transitions • For each such a sequence transition SeqT, find a suitable transition StateT in the state diagram of the object • StateT must emanate from the current object state
Algorithm (top) view - remarks • Hierarchical structure • Composite states include other states and redirect algorithm control flow to them • Transient and persistent states • Exception: completion transition • BFS traversal while searching for suitable transitions from a persistent state
Algorithm – Composite State • Run step(SequenceTransition) for each child state in the current object state • Possible results • Ambiguity (non-deterministic) • None found • Success
Algorithm – Persistent State • gatherResults(SequenceTransition) • Tries to find a suitable transition from (almost) each emanating leg • Completion transition is taken in account • step(SequenceTransition) • gatherResults(Transition)
Algorithm – Persistent State Leg • searchDown(fromState, Legs) • Tries to find a suitable transition that emanates from fromState • Logic for final, finish, join, and fork states, completion transition • step(SeqTransition, fromState) • Tries to match the object to the sequence transition • If ok, returns searchDown(targetOfThisLeg, remaining sequence diagram legs)
Design Decisions • XMI Parser mediator layer • Parser vendor independence • Saturateable states • Composite states, join state • Fork implementation • Current object (sub)state is held in the composite state that is the parent of the fork state • It is not held in the target composite state
Design Decisions (cont.) • Forks and joins as states • UML1.3 versus UML1.4 • Holding state information • Single threadedsolution • Concurrent composite states, forks • Coarse granularity step • Persistent state receives SequenceTransition as an argument, and not a sequence Leg • Composite states • Simple composite state is a concurrent composite state with one region
Other approaches • Code based visual simulations • Prosasim UML simulator • Formal logics methods • HUGO project • Automatic generation of state diagrams to sequence diagrams • PecSee project • Theoretic • Live Sequence Charts (LSC)
BVUML Summary • Strengths • UML input • Pre-implementation stage • Algorithmic approach • Weaknesses • Covers only the cases shown in the sequence diagrams