Presentation on theme: "CS 325: Software Engineering February 10, 2015 Object Interaction Modeling UML Sequence Diagrams Thermostat Controller Example UML Communication Diagrams."— Presentation transcript:
CS 325: Software Engineering February 10, 2015 Object Interaction Modeling UML Sequence Diagrams Thermostat Controller Example UML Communication Diagrams
UML Sequence Diagrams CS 325 February 10, 2015 Page 72 Sequence Diagrams illustrate the sequence of interactions between objects (or participants) in a software system. This diagram shows interactions between a customer and two software systems, using two form interfaces and an “order” object.
UML Sequence Diagrams: Lifelines CS 325 February 10, 2015 Page 73 Each object in a Sequence Diagram has a lifeline indicating its overall activity as the diagrammed interactions progress. Notice that the Order object is created during one interactive sequence, so its lifeline begins lower in the diagram.
UML Sequence Diagrams: Messages CS 325 February 10, 2015 Page 74 Interaction between objects is represented in a Sequence Diagram by horizontal arrows representing procedure calls. The initial message coming from outside of the system is called a “found message”, coming from an undetermined source.
UML Sequence Diagrams: Activation Bars CS 325 February 10, 2015 Page 75 Vertical activation bars are used to indicate that processes are being performed in response to messages. While activation bars are optional in UML 2, they tend to clarify the behavior taking place within a system.
UML Sequence Diagrams: Return Messages CS 325 February 10, 2015 Page 76 Return messages may be explicitly represented within a Sequence Diagram. Dashed backward arrows represent explicit return messages; missing backward arrows indicate implicit returns.
UML Sequence Diagrams: Synchronous Messages CS 325 February 10, 2015 Page 77 Some messages require responses before a process can proceed. One reason to show explicit responses is to emphasize which messages are synchronous (filled triangle arrowhead).
UML Sequence Diagrams: Asynchronous Messages CS 325 February 10, 2015 Page 78 Processes may proceed without awaiting responses for some messages. Asynchronous messages are represented with stick arrowheads (usually with implicit return messages).
UML Sequence Diagrams: Subprocesses CS 325 February 10, 2015 Page 79 Nested activation bars represent subprocesses within a Sequence Diagram. Nesting of processes is often rendered implicitly, in order to avoid overcomplicating the Sequence Diagram.
UML Sequence Diagrams: Interaction Frames CS 325 February 10, 2015 Page 80 Loops and conditionals may be represented in Sequence Diagrams via interaction frames. This interaction frame represents a loop that restricts the number of times a user may check his balance on an ATM.
Thermostat Controller Example CS 325 February 10, 2015 Page 81 Consider the embedded software for an industrial air conditioning unit. The controller sets the unit’s thermostat low when cool air is in greater demand (e.g., weekdays when the factory is in production) and high when it’s in less demand (during the evenings and overnight on weekdays, and at all times during weekends).
Thermostat Controller Example CS 325 February 10, 2015 Page 82 The factory manager may set the following parameters for the controller: HighTemp: Goal temperature when light (or no) cooling is needed WeekendDays: Days when thermostat is set to HighTemp all day LowTemp: Goal temperature when heavy cooling is needed PeakTimes: Ordered pair of times between which thermostat is set to LowTemp on non-WeekendDays Mode: Controller state (possibilities: StayLow, StayHigh, Normal)
Thermostat Controller Example CS 325 February 10, 2015 Page 83 Four main objects interact in this system: the controller, the thermostat, the clock, and the time period.
Thermostat Controller Example CS 325 February 10, 2015 Page 84 The primary Sequence Diagram for the thermostat controller involves adjusting to a new setting. Note that this action occurs only when the controller is in Normal mode at a time at the beginning or ending of the PeakTimes interval.
UML Communication Diagrams CS 325 February 10, 2015 Page 85 Communication Diagrams basically illustrate the same information as Sequence Diagrams, but with an emphasis on the inter-object relationships rather than the order in which messages are processed.