
1. UML Introduction
Introduction to UML (Unified Modeling Language)
Overview of UML
The Unified Modeling Language (UML) is a standardized visual language for specifying, visualizing, constructing, and documenting the artifacts of software systems. It is used to better understand the nature of a problem and its solution pathway, especially when code might be difficult to interpret or explain.
UML includes multiple diagrams, each representing a different aspect or perspective of the system. The main types of UML diagrams include:
- Use Case Diagrams
- Activity Diagrams
- Sequence Diagrams
- Class Diagrams
- Table Diagrams
Use Case Diagrams
A Use Case Diagram is a graphic depiction of the interactions among the elements of a system. It represents a set of use cases involving some system. A use case represents a particular functionality of a system.
Example:
- [Actor]-----[<<Use Case>>]
- [User]-----[Login]
Activity Diagrams
An Activity Diagram represents workflows of stepwise activities and actions with support for choice, iteration, and concurrency. In other words, it depicts certain conditions that exist during the flow of an algorithm.
Example:
- [Start]--->[Action1]--->[Decision]--->[Action2]--->[End]
Sequence Diagrams
A Sequence Diagram illustrates interactions between objects in a sequential order i.e., the order in which these interactions take place. We can also use the terms event diagrams or event scenarios to refer to a sequence diagram.
Example:
- Object1 --> Object2: Action
- Object2 --> Object1: Response
Class Diagrams
Class Diagrams define the types of objects in the system and the various kinds of static relationships that exist among them. They are primarily designed for software developers.
Symbols:
+
: Public
: Private
#
: Protected
Example:
- Class1
- -privateAttribute
- +publicMethod()
Table Diagrams
Table Diagrams represent database tables and their relationships, including primary and foreign keys.
Example:
- Table
- Primary Key
- Foreign Key
UML Relationships
UML diagrams use various types of arrows to depict relationships between entities:
- Composition: A "whole-part" relationship (e.g., a car is composed of its parts; the car is dependent on its parts).
- Aggregation: A "has-a" relationship, where a class contains another object but is not entirely dependent on it.
- Association: A "uses" relationship, where one class uses methods or properties of another class.
- Dependency: A "depends-on" relationship, where one class depends on another for its operation.
- Realization/Implementation: A "implements" relationship, where one class (usually an interface) is implemented by another class.
- Inheritance: A "is-a" relationship, where one class is a subtype of another class.
Examples:
- [Class1]<>-[Class2] : Composition
- [Class1]0-[Class2] : Aggregation
- [Class1]--[Class2] : Association
- [Class1]--->[Class2] : Dependency
- [Class1]▷--[Interface] : Realization/Implementation
- [SubClass]▷--[SuperClass] : Inheritance
Reference
The content in this document is based on the original notes provided in Azerbaijani. For further details, you can refer to the original document using the following link:
Original Note - Azerbaijani Version