UML
Transcript: Introduction to UML Amina Toumia Hamdi Guedes Charfeddine Hamdi UML Introduction Introduction WHAT IS UML? - UML is a standardized visual modeling language used in software engineering to represent, design, and communicate the structure, behavior, and relationships of software systems. UML DIAGrams Class diagram - It represents the static structure of a system, including classes, their attributes, methods, and relationships between classes. Class Diagram Let's understand more! Class diagram Complex Example Simple Example Elements of a Class Diagram Consider an online shop sytem with classes such as Admin, Guest, Customer, Product, Cart and Payment. Demonstrate the relationships between these classes, including associations and multiplicity. The arrows in the diagram represent associations between classes. The number next to the arrow represents the cardinality of the relationship. The attributes of each class are shown below the class name. Consider an online shop sytem with classes such as Customer, Order, Item, Orderdetail and Payment. Demonstrate the relationships between these classes, including associations and multiplicity. In UML models, an aggregation relationship shows a classifier as a part of or subordinate to another classifier. In UML modeling, a generalization relationship is a relationship in which one model element (the child) is based on another model element (the parent). In UML models, an association is a relationship between two classifiers, such as classes or use cases, that describes the reasons for the relationship and the rules that govern the relationship. - Class: Represents a blueprint for objects in a system, with attributes (variables) and methods (functions). - Association: Represents a relationship between two classes, indicating how they are connected. - Inheritance: Represents an "is-a" relationship between classes, where one class inherits properties and behaviors from another. - Aggregation/Composition: Represents a whole-part relationship between classes. - Multiplicity: Represents the number of instances of one class that can be associated with another class. USE CASE DIAGRAM - A use case diagram represents the interactions between actors and the system being modeled. - Use cases represent the functionality or actions that the system performs in response to user interactions. Elements of a Use Case Diagram Use Case Diagram - Actor: Represents a user or external system interacting with the system. - Use Case: Represents a specific functionality or action performed by the system. - Association: Represents a relationship between an actor and a use case. - Include/Extend: Represents relationships between use cases, where one use case includes or extends another. SIMPLE EXAMPLE TASK: Consider a student management system. Show use cases such as "Check attendance," "Check grades," and "Update attendance" and how they are associated with the actors. In this use case diagram: The use cases associated with the "Student" actor are "Check attendance", "Check timetable" and "Check grades". The use cases associated with the "Teacher" actor are "Check attendance" ,"Check timetable", "Check grades", "Update attendance" and "Update grades". COMPLEX EXAMPLE TASK: Consider a simple ATM system with actors like User and Bank. Show use cases such as "Withdraw Cash," "Check Balance," and "Deposit Money" and how they are associated with the actors. In this use case diagram: The "User" actor represents the ATM user who interacts with the system. The "Bank" actor represents the bank that provides the ATM services. The use cases associated with the "User" actor are "Insert Card," "Enter PIN," "Withdraw Cash," "Check Balance," and "Deposit Money." The use cases associated with the "Bank" actor are "Verify PIN," "Dispense Cash," and "Update Balance." The arrows represent the associations between the actors and the use cases, indicating the interactions between them. To indicate include and exclude relationships, we can use the following notations: Include relationship: "Withdraw Cash" includes "Check Balance": This means that when a user performs the "Withdraw Cash" use case, it includes the functionality of checking the balance before the withdrawal. Exclude relationship: "Deposit Money" is excluded from "Withdraw Cash": This means that the "Deposit Money" use case cannot be performed simultaneously with the "Withdraw Cash" use case. They are mutually exclusive. SEQUENCE DIAGRAM Sequence Diagram - A sequence diagram represents the interactions and messages exchanged between objects or components within a system. - It shows the sequence of events or steps that occur during a particular scenario or use case. Examples Sequence Diagram examples Simple EX: Sequence diagram of an Online Movie Ticket Booking System A solid line denotes a request message (i.e. a call initiated by a sender), a dashed line denotes a response message (i.e. the answer to a call). Complex ex: Sequence diagram of a purchase in