What is UML Diagram?
UML is an acronym for "Unified Modeling Language".
UML is one of the most popular business process modelling techniques to document and model software.
UML is used as a general-purpose modelling language in the software engineering field for documenting several business processes or workflows.
Types
UML diagrams have 2 main categories :
- Behavioral UML Diagrams
- Structural UML Diagrams Each one of them is divided into subcategories.
Behavioral UML Diagrams
They are used to visualize and document the dynamic aspects of a system. They show how the system behaves and how it interacts with other entities including the user and the other systems.
They show how data moves through the system, and the passage of time effect on the system, and the events causing the system to change its internal states.
Types
- Activity Diagram
- Use Case Diagram
- State Machine Diagram
- Sequence Diagram
- Timing Diagram
- Interaction Overview Diagram
- Communication Diagram
Activity Diagram
It is used to describe the flow of different activities and actions in a system which can be at different levels of abstraction.
They describe the relationship between different activities, and the objects used or consumed or produced by the activity.
Example
We want to represent actions, conditions, and transitions in the system then we can represent them like this.
Note that the System ends only if the condition result is "Yes" (accept and go to "Action C").
Use Case Diagram
It is used to analyze the system’s requirements in a high-level approach. It enables us to relate what we need from a system to how the system will deliver on those needs.
Every use case diagram consists of 3 parts :
- Functional requirements : are represented as use cases. They are the actions to be done by the actuators.
- Actors : We can call them the game players or the ones who control events. They can be humans, an organization, or internal or external applications.
- Relationships : are between actors and use cases. They are represented using straight arrows. All the actors don't have to have the same access control over the same actions.
Example
We can have a "Store" with only two actors :
- Buyer
- Seller
There are 3 actions (functional requirements) that can happen in :
- Say "Hello". --> (done by Buyer, and Seller )
- Buy a product. --> (done by Buyer )
- Sell a product. --> (done by Seller )
State Machine Diagram
It is used to describe the different states of an object in a system.
It is named "state machine" because the diagram represents a machine that describes the several states of an object with its changes based on external and internal events.
An object responds differently to the same event depending on what state it is in.
Example
We can use it for describing a chess game where with every move for both of the opponents the state of the game changes as the move may lead to a stalemate or a checkmate for any of the players.
Sequence Diagram
It shows the sequence of interactions and communication (messages and requests passing) between actors and objects.
Objects (actors) can be active only when needed or when there is another object that wants to communicate with them.
It shows the object time when it is needed, and the time interval for it described in the diagram makes the sequence diagrams special.
Example
Class Diagram
It describes the structure of a system by showing the system's classes, interfaces, and relationships. It is usually used for modeling object-oriented systems.
Example
Using the Object-oriented programming approach if we want to describe a human body using a class diagram then it would be like this :
Note that we have only 3 classes and the red text and red arrows are for the explanation.
Thank you, and goodbye.