UML Diagrams Tutorial PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document covers different types of UML diagrams, including structural diagrams like class diagrams, object diagrams, and physical diagrams; behavioral diagrams like the state machine diagram; and interaction diagrams like use case diagrams. It also discusses relationships in UML, such as dependency and association, as well as important examples. This document is helpful to understand UML diagrams for object-oriented programming and software design.
Full Transcript
# UML Diagrams **Monday 26/08/24** ## Types of UML Diagrams 1. **Structural Diagram** * This type of diagram describes the specifications of a system. These diagrams can be further classified as logical or physical. * **Logical Diagram:** It represents the logical structure of th...
# UML Diagrams **Monday 26/08/24** ## Types of UML Diagrams 1. **Structural Diagram** * This type of diagram describes the specifications of a system. These diagrams can be further classified as logical or physical. * **Logical Diagram:** It represents the logical structure of the system. * **Physical Diagram:** It represents the physical structure of the system. 2. **Behavioural Diagram** * It describes the behavioural features of a system. 3. **Class Diagram** * It shows the set of classes, interfaces, and collaborations in a system. * A class diagram is a collection of vertices and edges. * A class diagram address the static design view of the system. 4. **Object Diagram** * An object diagram shows a set of objects and their relationships at a point in time. * An object diagram represents and shows a set of views, snapshots, and instances of an object diagram. * It addresses the static design view of the system. 5. **Use Case Diagram** * A use case diagram represents or shows a use case and actors. * A use case diagram shows a set of use cases and actors. 6. **Interaction Diagram** * An interaction diagram shows an interaction of a set of objects, and their relationships, along with messages that are shared among them. 7. **Collaboration Diagram** * A collaboration diagram is an interaction diagram that focuses on the structural organization of the objects that send and receive messages. 8. **State Machine Diagram** * It shows a state machine, which includes states, events, transactions, and activities. * It is a dynamic view of the system. 9. **Activity Diagram** * It is a special kind of state chart diagram, which shows the flow from one activity to another within the system, and has a dynamic view of the system. 10. **Component Structure Diagram** * This diagram explores how objects cooperate to complete a task, documents the internal structure of a system and object, or graphically describes a design structure or strategy. 11. **Deployment Diagram** * This diagram shows configuration of runtime processing nodes, or objects that exist on them. 12. **Package Diagram** * This diagram describes the high-level organization of software packages. * Software packages, which are used to reveal the model, are logically contained or packaged, and describe the interactions between them at a high level. 13. **Component Structure Diagram** * This diagram shows the organization and dependency among a set of components. * A component structure diagram is a static view. 14. **Timing Diagram** * This diagram combines a state diagram and a message view of an object state, which modify that step. 15. **Sequence Diagram** * This diagram shows the time ordering of messages and object lifelines. ## Important Diagrams of UML **Things of UML** | Type | UML Representation | |---------------------|------------------------| | Structure Things | Class, interface, use case, collaboration | | Behavioural Things | Interaction, state machine | | Grouping things | Package | | Annotational Things | Note | **Examples** * **Class** * Fruits: * color * struct * eat() * **Use Case** * window -> slide (open, close) * **Grouping Things** * 1) message * Student -> Id ( name, struct) * 2) waiting * State * To state multiple classes is called a package. * **Note** * Note ## Relationships in UML * The most important building block in a UML is the relationship. * A relationship is a connection between things when we model a system. * We are supposed to not only identify the things that form the vocabulary of the system but also how these things are related to each other. **Types of Relationships** 1. **Dependency** * Student -> College * id() * name * study() * exam * Dependency is a semantic relationship between two things in which a change in one element also affects the other one. 2. **Association** * Passenger -> Airplane * Association is a structural relationship in which objects are dually dependent. * Association relationships are given when we want to show structural relationships. * Association is basically a set of links that connect elements of a UML model. It also describes how many objects are taking part in that relationship. * It is represented graphically as a solid line. It shows the association of objects, Airplane and Passengers, for example. 3. **Generalization** * SavingAlc -> Current Alc (Account) * Generalization is a relationship between a general thing that is a superclass or parent class, and specific things that are subclasses or child classes. It is a similar concept to inheritance in OOP. It is also known as an "IS-A" relationship since the child class is a type of parent class. 4. **Realization** * Printer -> Printer SetUp * Realization is a semantic relationship between classifiers where one classifier specifies a contract that another classifier guarantees to carry out. When one object carries another object, this dependency is called a realization. ## Multiplicity * It is the active logical when the cardinality of a class in a relation to another is depicted. It is also called cardinality. * For example, one flip may include multiple flips while only one commercial continues o to one passenger. ○.. • in the diagram means 0 to many. ## UML Architecture (Important Diagram) | Type | Description | |---------------------|--------------------------------| | Conceptual | logical view class, object, package, composite, structure, state, machine | | Physical | Implementation View, components | | Use Case View | Use Case View, Use Case Activity | | Process View | Process View, Communication Activity, timing interaction view | | Deployement View | Deployement View, Deployement | ## Advantages and Disadvantages of UML (Important)