140 likes | 361 Vues
Sequence Diagrams. Sequence diagrams. Sequence diagrams is a picture that shows, for a particular scenario of a use case, the events that external actors generate, their order and the inter-system events. All systems are treated as a black box
E N D
Sequence diagrams • Sequence diagrams is a picture that shows, for a particular scenario of a use case, the events that external actors generate, their order and the inter-system events. • All systems are treated as a black box • The emphasis of this diagram is events that cross the system boundary from actors to systems. • The sequence diagram is a very useful tool to easily represent the dynamic behaviour of a system.
The sequence diagrams purpose • The sequence diagram is used to primarily to show a sequence of interactions between different actors and the system called objects over a period of time. • A Systems Analyst can find sequence diagrams useful in documenting how a future system should behave. • An organization’s developers can use this diagram to force out the system’s object interactions thus fleshing out overall system design.
Elements of Sequence Diagram Object: This is the primary element involved in a sequence diagram is an object ( actor or an instance of a class). An object is represented by a named rectangle with a dashed line descending from the center of the bottom edge. . The name to the left of the “:” is the object name and to its right is the class name.
freshman: student Fig No.1
Elements of Sequence Diagram • Messages: The interaction between objects in a sequence diagram is represented as messages.An object sends a message to another object, by means of a line with an arrow pointing towards the receiving object. The message/method name is placed above the arrowed line. The message that is being sent to the receiving object represents an operation/method that the receiving object’s class implements.
Elements of Sequence Diagram • The first message of a sequence diagram starts at the top and is typically located on the left side of the diagram for readability. Subsequent messages are then added to the diagram slightly lower then the previous message.
Elements of Sequence Diagram Return Message. A return message is drawn as a dotted line with an arrowhead back to the originating lifeline and above this dotted line return value from the operation is placed. The return messages are optional part of a sequence diagram. Return messages are useful if finer details is required, otherwise invocation message is sufficient.
Elements of Sequence Diagram • Iterations: A box is drawn to show the iterations i.e. the message are repeated a number of times. An asterisk is placed at the bottom of the box.
Verify card details Card details OK Verify account Account OK Withdraw request Withdraw request OK
Scenario for processing a Sale using POS system. • Customer arrives at a POS checkout with goods and /or services to purchase. • Cashier starts a new sale. • Cashier enters item identifier, and quantity. • System records sale line item and presents item description, price and running total. • Cashier repeats steps 3-4 until indicates done( end sale) • System presents total with taxes calculated • Cashier tells Customer the total and asks for payment • Customer pays ( make payment) • System handles payment i.e. outputs how much change is due and receipt.
Requirement Statement for using an ElevatorA product is to be installed to control elevators in a building with m floors. The problem concerns the logic required to move elevatorsbetween floors according to the following constraints: Each elevator has a set of m buttons, one for each floor. These illuminate when pressed and cause the elevator to visit the corresponding floor. The illumination is canceled when the elevator visits the corresponding floor. Each floor, except the first floor and top floor has two buttons, one to request and up-elevator and one to request a down-elevator. These buttons illuminate when pressed. The illumination is canceled when an elevator visits the floor and then moves in the desired direction. When an elevator has no requests, it remains at its current floor with its doors closed.
Basic scenario of an Elevator • Passenger pressed floor button • Elevator controller detects floor button pressed • Elevator Controller moves Elevator to the floor • Elevator Controller makes the Elevator doors open • Passenger gets in and presses elevator button • Elevator Controller makes the Elevator doors close • Elevator Controller makes the Elevator moves to required floor • Elevator Controller makes the Elevator doors open • Passenger gets out • Elevator Controller makes the Elevator doors close