Different UML Diagrams - Purpose and Usage
What is UML?
UML stands for Unified Modeling Language. It's an international industry standard graphical notation used for describing, visualizing, constructing and documenting the artifacts of a software system.
What're the Purposes of UML?
- To reason about system behavior.
- To detect errors and omissions early in the life cycle.
- To present proposed designs and communicate with stakeholders.
- To understand requirements.
- To drive implementation.
What are the types of UML Diagram?
- UML Use Case Diagram
- UML Sequence Diagram
- UML Component Diagram
- UML Class Diagram
- UML Activity Diagram
- UML Collaboration Diagram
- UML Deployment Diagram
- UML Statechart Diagram
- UML Package Diagram
Look at this table to figure out the differences of various UML diagrams.
UML Use Case Diagram
Use case diagram is used during the analysis phase of a project to identify the system functionality. It describes the interaction of people or external device with the system under design. It doesn't show much detail, but only summarizes some of the relationships between use cases, actors, and systems.
Basically four elements need to be included in use case diagram. They are actors, system, use case, and relationship. Actors represent whoever or whatever interact with the system. They can be humans, other computers, or other software systems. Use cases represent the actions that are performed by one or more actors for a particular goal. System is whatever you are developing.
Learn More at: Use Case Diagram
UML Sequence Diagram
Sequence diagrams are used in the analysis and design phases. It's an interaction diagram that details how operations are carried out. Sequence diagram is often used to depict the chronologically-structured event flow through a use case. It's good at presenting the communication relationships between objects; and what messages trigger those communications.
Lifeline represents typical instances of the components or classes in your system. Messages are shown as arrows. They can be complete, lost or found; synchronous or asynchronous; call or signal. Activate is used to denote participant activation. Once a participant is activated, its lifeline appears. Objects are model elements that represent instances of a class or of classes. Classes in UML show architecture and features of the designed system. Actor specifies a role played by a user or any other system that interacts with the subject.
Learn More at: Sequence Diagram Software
UML Activity Diagram
The purpose of activity diagram is to describe the procedural flow of actions as part of a larger activity. It is used to model how activities are coordinated to provide a service; to show the events needed to achieve some operation, and to illustrate how the events in a single use case relate to one another.
Activity diagrams consist of activities, states and transitions between activities and states. The initial state is the starting point on the activity diagram. It is the point at which you begin reading the action sequence. An activity is a unit of work that needs to be carried out. State defines current condition of an event or activity. Decision activity is introduced in UML to support conditionals in activities. It shows where the exit transition from a state or activity may branch in alternative directions depending on a condition. The bar represents synchronization of the completion of those activities. Control flow in computer science refers to the order in which the individual statements, instructions or function calls of an imperative or a declarative program are executed or evaluated. An object flow is the same thing as a control flow, but it is shown as a dashed line instead of a solid one.
Learn More at: Activity Diagram
UML Collaboration Diagram
A collaboration diagram is used to describe a collection of objects that interact to implement some behavior within a context. It's used to model system functionality, which in specific, visualize the relationship between objects collaborating to perform a particular task and model the logic of the implementation for a complex operation.
Collaboration diagram is also called communication diagram or interaction diagram. It consists of object, multi-object, actor, association role, delegation, link to self, constraint and note. Objects are model elements that represent instances of a class or of classes. Multi-object represents a set of lifeline instances. Link-to-self is used to link a message which can be sent from an object to itself.
Learn More at: Collaboration Diagram
UML Class Diagram
A UML class diagram is not only used to describe the object and information structures in an application, but also show the communication with its users. It provides a wide range of usages; from modeling the static view of an application to describing responsibilities for a system. Composition is a special type of aggregation that denotes a strong ownership.
In a UML class diagram, classes represent an abstraction of entities with common characteristics. Associations represent static relationships between classes. Aggregation is a special type of association in which objects are assembled or configured together to create a more complex object. Generalization is a relationship in which one model element (the child) is based on another model element (the parent). Dependency relationship is a relationship in which one element, the client, uses or depends on another element, the supplier.
Learn More at: UML Class Diagram
UML Component Diagram
It allows application designers to verify that a system's required functionality is being implemented by components, thus ensuring that the final system will be acceptable. What's more, component diagram is useful communication tool among stakeholders to discuss, analyze or improve a system design.
The UML component diagram doesn't require many notations, thus very easy to draw. Below is a UML 1.0 component diagram example, requiring only two symbols: component and dependency.
Learn More at: UML Component Diagram
UML Deployment Diagram
Deployment diagram is used to describe the hardware components used in system implementations and the execution environments and artifacts deployed on the hardware. It's used to visualize the hardware topology system, model physical hardware elements and the communication relationship between them, and plan the architecture of the system.
Nodes represent either hardware devices or software execution environments. They could be connected through communication paths to create network systems of arbitrary complexity. Component represents a modular part of a system. A component defines its behavior in terms of provided and required interfaces. Dependency relationship is a relationship in which one element, the client, uses or depends on another element, the supplier.
Learn More at: Deployment Diagram
UML State Diagram
Statechart diagrams are used to model dynamic nature of a system. They describe all of the possible states of an object as events occur. So the most important purpose of Statechart diagram is to model life time of an object from creation to termination.
A state is a condition during the life of an object during which it satisfies some condition, performs some activity, or waits for some external event. A start state is the state that a new object will be in immediately following its creation. An end state is a state that represents the object going out of existence. A transition is a relationship between two states indicating that an object in the first state will perform certain actions and enter the second state, when a specified set of events and conditions are satisfied.
Learn More at: UML Statechart
UML Package Diagram
Package diagrams are used to organize the elements of a model. They are typically used to depict the high-level organization of a software project. Package diagram can show both structure and dependencies between sub-systems or modules. They can be used to group any construct in the UML such as classes, actors, and use cases.
The package element in UML is represented by a folder icon. Each package represents a namespace. Packages can also be members of other packages, providing for a hierarchic structure in which top-level packages are broken down into sub-packages.
Learn More at: Package Diagram