In: Computer Science
Due Friday Oct. 30th, 11:59pm (10 marks total):
1. Explain the purpose of a sequence diagram. .
2. Draw a sequence diagram for the online ticketing system in Assignment #3. Identify the objects, lifelines, messages, and focuses in your diagram. .
ANSWER1).UML Sequence Diagrams are interaction diagrams that detail how operations are carried out. They capture the interaction between objects in the context of a collaboration. Sequence Diagrams are time focus and they show the order of the interaction visually by using the vertical axis of the diagram to represent time what messages are sent and when.
Sequence Diagrams captures:
Purpose of Sequence Diagram
ANSWER 2).SEQUENCE DIAGRAM FOR ONLINE TICKETING SYSTEM
EXAMPLE 1:
EXAMPLE 2:
Objects:
Objects that are involved in the sequence of events you are documenting should be placed at the top of the sequence diagram across its horizontal axis. As shown in above figures it's a good idea to place the actor that initiates a particular sequence at the upper left side of the diagram. You can also place a "UI" (user interface) placeholder class on the diagram with which the actor interacts. This is an excellent tool for providing context for a use case.
Next, you can place objects on the diagram that are instantiated by the UI or by other objects. You should place the most important objects to the left and subordinate objects to the right. It's best to place objects on the diagram in a way that minimizes lines that cross.
In figure 1: objects are Passenger,Flight,Available flight,passenger information,Meal and set,Reservation and Payment
In figure 2: Objects are Admin,Registered user,visitor,movies,book ticket and payment.
Lifelines
The lifeline is the dotted line that extends down the vertical axis from the base of each object. The lifeline indicates the life span of an object over a period of time.
Messages
Messages are the most important elements of a sequence diagram. They indicate when one object calls an operation on another object (or itself). They are also used to indicate return values. Message flow begins at the top left object (which is usually an actor) and flows down the vertical axis from one object to another.
In figure 1:Message are search(),select,select(),fillup(),choose() and so on.
In figure 2: Messages are AddMoviesRecords(),UpdateMovieRecord(),DeletMoviesRecord(),ShowMovies() and so on.
Focus of Control
Focus of control (FOC) is used in sequence diagrams to show the period of time during which an object performs an action. FOC is rendered as a thin, rectangular object that sits on top of object lifelines. The top of the FOC rectangle coincides with the receipt of a message. The bottom of the rectangle coincides with the completion of an action and can be marked with a return message.