Using UML Patterns and Java Object Oriented Software Engineering Chapter 5 Analysis Dynamic Modeling Outline of the Lecture Dynamic modeling Sequence diagrams State diagrams Using dynamic modeling for the design of user interfaces Analysis example Requirements analysis document template Non Functional Requirements Visual modeling in UML Requirements analysis model validation in Appendix Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 2 Dynamic Modeling with UML Diagrams for dynamic modeling Interaction diagrams describe the dynamic behavior between objects Statecharts describe the dynamic behavior of a single object What object Interaction diagrams Sequence Diagram Dynamic behavior of a set of objects arranged in time sequence Good for real time specifications and complex scenarios Collaboration Diagram Shows the relationship among objects Does not show time State Chart Diagram A state machine that describes the response of an object of a given class to the receipt of outside stimuli Events Activity Diagram A special type of statechart diagram where all states are action states Moore Automaton Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 3 Dynamic Modeling Definition of dynamic model See the definition on the previous slide consistent A collection of multiple state chart diagrams one state chart diagram for each class with important dynamic behavior Purpose Detect and supply methods for the object model How do we do this This is somewhat over simplified Why Start with use case or scenario Model interaction between objects sequence diagram Model dynamic behavior of a single object statechart diagram Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 4 An Example Flow of events in a Get SeatPosition use case 1 Establish connection between smart card and onboard computer 2 Establish connection between onboard computer and What would this be for sensor for seat 3 Get current seat position and store on smart card What would be the concerns of the end user Which are the objects Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 5 Sequence Diagram for Get SeatPosition 1 Establish connection between smart card and onboard computer Smart Card 2 Establish connection between onboard computer and sensor for seat 3 Get current seat position and store on smart card time Bernd Bruegge Allen H Dutoit Onboard Computer Establish Connection Seat Establish Connection Accept Connection Accept Connection Get SeatPosition 500 575 300 Object Oriented Software Engineering Using UML Patterns and Java Is this a good Sequence Diagram next slide 6 Heuristics for Sequence Diagrams Layout What are the diagrammatic conventions 1st column Should correspond to the actor who initiated the use case 2nd column Should be a boundary object 3rd column Should be the control object that manages the rest of the use case Creation Control objects are created at the initiation of a use case Boundary objects are created by control objects Access Entity objects are accessed by control and boundary objects Entity objects should never call boundary or control objects This makes it easier to share entity objects across use cases and makes entity objects resilient against technology induced changes in boundary objects Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 7 Is this a good Sequence Diagram First column is not the actor Smart Card Onboard Computer Establish Connection It is not clear where the boundary object is It is not clear where the control object is Seat Establish Connection Accept Connection Accept Connection Get SeatPosition 500 575 300 Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 8 What else can we get out of sequence diagrams Is this really true Is automatic derivation possible then Sequence diagrams are derived from the use cases We therefore see the structure of the use cases The structure of the sequence diagram helps us to determine how decentralized the system is We distinguish two structures for sequence diagrams Fork and Stair Diagrams Ivar Jacobsen Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 9 Fork Diagram Much of the dynamic behavior is placed in a single object ususally the control object It knows all the other objects and often uses them for direct questions and commands Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 10 Stair Diagram The dynamic behavior is distributed Each object delegates some responsibility to other objects Each object knows only a few of the other objects and knows which objects can help with So is there any control object then a specific behavior Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 11 Fork or Stair Which of these diagram types should be chosen Object oriented fans claim that the stair structure is better The more the responsibility is spread out the better However this is not always true Better heuristics Decentralized control structure Centralized control structure better support of change So only 1 control object or more Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 12 UML Statechart Diagram Notation Event trigger With parameters State1 Event1 attr condition action do Activity entry action exit action Guard condition State2 Also internal transition and deferred events Notation based on work by Harel Added are a few object oriented modifications A UML statechart diagram can be mapped into a finite state machine Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 13 State An abstraction of the attributes of a class State is the aggregation of several attributes a class Basically an equivalence class of all those attribute values and links that do no need to be distinguished as far as the control structure of the system is concerned Example State of a bank A bank is either solvent or insolvent State has duration Bernd Bruegge Allen H Dutoit Object Oriented Software Engineering Using UML Patterns and Java 14 Example of a StateChart Diagram coins in amount set balance Idle Collect Money coins in amount add to balance cancel refund coins item empty select item change 0 do
View Full Document
Unlocking...