Guards
To model conditions we use guards in UML. They are used when we need to restrict the flow of messages on the pretext of a condition being met. Guards play an important role in letting software developers know the constraints attached to a system or a particular process.
For example:
In order to be able to withdraw cash, having a balance greater than zero is a condition that must be met as shown below.
The above sequence diagram depicts the sequence diagram for an emotion based music player:
- Firstly the application is opened by the user.
- The device then gets access to the web cam.
- The webcam captures the image of the user.
- The device uses algorithms to detect the face and predict the mood.
- It then requests database for dictionary of possible moods.
- The mood is retrieved from the database.
- The mood is displayed to the user.
- The music is requested from the database.
- The playlist is generated and finally shown to the user.
Sequence Diagrams | Unified Modeling Language (UML)
Unified Modelling Language (UML) is a modeling language in the field of software engineering that aims to set standard ways to visualize the design of a system. UML guides the creation of multiple types of diagrams such as interaction, structure, and behavior diagrams. A sequence diagram is the most commonly used interaction diagram.
Interaction diagram
An interaction diagram is used to show the interactive behavior of a system. Since visualizing the interactions in a system can be difficult, we use different types of interaction diagrams to capture various features and aspects of interaction in a system.
- A sequence diagram simply depicts the interaction between the objects in a sequential order i.e. the order in which these interactions occur.
- We can also use the terms event diagrams or event scenarios to refer to a sequence diagram.
- Sequence diagrams describe how and in what order the objects in a system function.
- These diagrams are widely used by businessmen and software developers to document and understand requirements for new and existing systems.
Important Topics for the Sequence Diagrams
- Sequence Diagram Notation
- Actors
- Lifelines
- Messages
- Create message
- Delete Message
- Self Message
- Reply Message
- Found Message
- Lost Message
- Guards
- How to create Sequence Diagrams?
- Use cases of Sequence Diagrams
- Challenges of using Sequence Diagrams
Contact Us