Understanding UML Sequence Diagrams and Their Applications

Slide Note
Embed
Share

UML sequence diagrams depict how objects interact in a given scenario, showcasing messages sent between targets on lifelines. They are valuable for detailing use cases, modeling logic, task flow between components, and understanding process functionality. Objects, boundaries, controls, and stereotypes play key roles in sequence diagrams, aiding in representing system data, interactions with actors, and orchestration of commands. Naming conventions are essential to differentiate objects effectively.


Uploaded on Jul 22, 2024 | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. UML SEQUENCE DIAGRAM L4 25-2-2020

  2. UML sequence diagrams UML sequence diagrams are used to show how objects interact in a given situation. A sequence diagram is made up of targets sending messages to other targets on their lifelines. An important characteristic of a sequence diagram is that time passes from top to bottom; the interaction starts near the top of the diagram and ends at the bottom

  3. Applications of Sequence Diagram Represents the details of a UML use case. Models the logic of a sophisticated procedure, function, or operation. Shows how tasks are moved between objects or components of a process. Helps to plan and understand the detailed functionality of an existing or future scenario.

  4. Components of a Sequence Diagram 1.Targets Objects/classes Objects as well as classes can be targets on a sequence diagram, which means that messages can be sent to them. A target is displayed as a rectangle with some text in it.

  5. Objects/lasses Stereotype of Objects Entities/ entity objects Entities are objects representing system data: Customer, Product, Transaction, Cart, etc. Boundaries/ boundary objects Boundaries are objects that interface with system actors: User Interface, Database Gateway,, etc. Controls/ control objects Controls are objects that mediate between boundaries and entities. They orchestrate the execution of commands coming from the boundary by interacting with entity and boundary objects. Controls often correspond to use cases.

  6. Display Icons for Stereotype of Objects

  7. Other notations for Stereotype of Objects 1. 2. 3. students:Student Object collection

  8. Naming objects - Rules/Conventions An object should be named only if at least one of the following applies You want to refer to it during the interaction as a message parameter or return value You don't mention its type There are other anonymous objects of the same type and giving them names is the only way to differentiate them Avoid long and non-descriptive names (instead of aStudent use s )

  9. 2. Messages When a target sends a message to another target, it is shown as an arrow between their lifelines. The arrow originates at the sender and ends at the receiver. Near the arrow, the name and parameters of the message are shown. Types of messages: Synchronous message Instantaneous message Found message Asynchronous messages Message to self Creation and destruction

  10. Synchronous message A synchronous message is used when the sender must wait until the receiver has finished processing the message, only then does the caller continue (i.e. a blocking call). Most method calls programming languages are synchronous. Represented by a solid line with a solid arrowhead. in object-oriented

  11. Synchronous message To show that that the receiver has finished processing the message and returns control to the sender

  12. Instantaneous message Messages are often considered to be instantaneous, i.e., the time it takes to arrive at the receiver is negligible. For example, an in-process method call. Such messages are drawn as a horizontal arrow.

  13. Non-Instantaneous message Sometimes however, it takes a considerable amount of time to reach the receiver. For example, a message across a network. Such a non-instantaneous message is drawn as a slanted arrow. (use only when you want to emphasize the time delay)

  14. Found message A found message is a message of which the caller is not shown. Depending on the context, this could mean that either the sender is not known, or that it is not important who the sender was. The arrow of a found message originates from a filled circle.

  15. Asynchronous message With an asynchronous message, the sender does not wait for the receiver to finish processing the message, immediately. Messages sent to a receiver in another process or calls that start a new thread are examples messages. An open arrowhead is used to indicate that a asynchronously. it continues of asynchronous message is sent

  16. Asynchronous message

  17. Message to self A message that an object sends itself can be shown as follows : The purpose of a sequence diagram is to show the interaction between objects, use self message when really necessary.

  18. Constructor Messages A constructor message creates its receiver. Targets that exist at the start of an interaction are placed at the top of the diagram. Any targets that are created during the interaction are placed further down the diagram, at their time of creation. Hence, sender already exists and then creates the receiver.

  19. Constructor message

  20. Destructor Message A destructor message destroys its receiver. A target's lifeline extends as long as the target exists. If the target is destroyed during the interaction, the lifeline ends at that point in time with a big cross.

  21. Destructor Message

  22. Creation and destruction

  23. 3. Conditional interaction A message can include a guard, which signifies that the message is only sent if a certain condition is met. The guard is simply that condition between brackets. If you want to show that several messages are conditionally sent under the same guard, you'll have to use an 'opt' combined fragment. (shown as a bigger encompassing rectangle)(equals to if-construct )

  24. Conditional interaction

  25. Alternative interaction If you want to show several alternative interactions, use an 'alt' combined fragment. Equals to nested if-then-else and switch/case constructs in programming languages.

  26. 4. Repeated interaction When a message is prefixed with an asterisk (the '*'-symbol), it means that the message is sent repeatedly. A guard indicates the condition that determines whether or not the message should be sent (again). As long as the condition holds, the message is repeated.

  27. If you want to show that multiple messages are sent in the same iteration, a 'loop' combined fragment can be used.

  28. References http://www.tracemodeler.com/articles/a_quic k_introduction_to_uml_sequence_diagrams/

More Related Content