Unified Modeling Language - CSU1296 | Shoolini University

Unified Modeling Language (UML)

In short...

0.1. What is UML?

UML = Unified Modeling Language

A visual language, not a programming one.

Used to design, understand, and communicate software architecture.

Standardized by ISO in 2005.

Why care?: Helps developers + non-programmers (like clients) see the system clearly before building it.

0.2. Why UML is Needed

Makes team collaboration easier for complex systems.

Helps non-tech stakeholders understand the system (like businessmen).

Saves time by visualizing structure + flow.

0.3. Types of UML Diagrams

Class Diagram

Most important.

Shows classes, their attributes, methods, and relationships.

Example: Social Media
User ← Post ← Comment ← Like (associations + inheritance)

Use Case Diagram

Shows what actors (users) can do with the system.

Captures functional requirements.

Example: E-commerce
Actor = User
Use Cases = Browse, Add to Cart, Checkout

Sequence Diagram

Shows how objects interact over time.

Message flow between objects in sequence.

Example: Money Transfer in Banking
User → Login → Check Balance → Transfer Funds

Activity Diagram

Like flowcharts: shows the workflow/logic of a system.

Supports sequential + parallel flows.

Example: Login Process
Start → Enter Username → Enter Password → Authenticate → Grant Access

0.4. Object-Oriented Concepts in UML

Concept Quick Meaning
Class Blueprint of an object
Object Real instance of a class
Inheritance Reuse code from parent
Abstraction Show only important stuff
Encapsulation Hide data inside class (private fields)
Polymorphism Same function behaves differently

0.5. UML Tools

  • Lucidchart – Easy, online, collaborative
  • Draw.io – Free, integrates with Drive
  • StarUML – Open-source
  • Visual Paradigm – Full software suite

1. Introduction

Unified Modeling Language (UML) is a standardized visual language used to represent the structure and design of a software system. It is not a programming language but a diagrammatic approach that helps both technical and non-technical stakeholders understand how a system is organized and how it behaves.

2. What is UML?

3. Why is UML Needed?

  1. Improves communication among developers, designers, and clients.
  2. Helps non-programmers understand the system through visual diagrams.
  3. Saves time during development by clearly showing structure, workflow, and interactions.
  4. Essential in team projects where multiple people work on different parts of a system.

4. Major UML Diagrams

4.1. Class Diagram

A Class Diagram is the most commonly used UML diagram in object-oriented design. It depicts the static structure of a system by showing its classes, their internal structure, and the relationships between them.

Key Components:
Purpose:
Example:

For a social media system, you might have:

graph LR
    A[Class Diagram] --> B[Represents static structure]
    A --> C[Used in Object-Oriented Design]
    A --> D[Shows Classes, Attributes, Methods, and Relationships]

    D --> E[Class: Box with 3 parts]
    E --> E1[Class Name]
    E --> E2["Attributes (Data)"]
    E --> E3["Methods (Functions)"]

    D --> F[Relationships]
    F --> F1[Association: A uses B]
    F --> F2[Inheritance: A is a B]
    F --> F3["Aggregation: A has B (can exist independently)"]
    F --> F4["Composition: A owns B (can't exist independently)"]

    A --> G[Purpose]
    G --> G1[Software Blueprint]
    G --> G2[Design Architecture]
    G --> G3[Clarify Responsibilities]

    A --> H[Example: Social Media]
    H --> H1[User → Post → Comment]

4.2. Use Case Diagram

A Use Case Diagram illustrates the functional requirements of a system from the end-user's perspective. It identifies the interactions between actors (users or external systems) and the system through various use cases.

Key Components:
Purpose:
Example:

For an e-commerce site:

graph LR
    A[Use Case Diagram] --> B[Shows Functional Requirements]
    A --> C[From End-User's Perspective]
    A --> D[Interaction: Actor ↔ Use Case]

    D --> E[Key Components]
    E --> E1[Actors: Users or External Systems]
    E --> E2[Use Cases: Tasks/Goals]
    E --> E3[System Boundary: Scope Box]
    E --> E4[Relationships]

    E4 --> R1[Association: Actor ↔ Use Case]
    E4 --> R2[Include: Always includes another use case]
    E4 --> R3[Extend: Optional or conditional scenarios]

    A --> F[Purpose]
    F --> F1[Defines WHAT system does]
    F --> F2[Used in Requirement Analysis]
    F --> F3[Clarifies User Expectations]

    A --> G[Example: E-commerce System]
    G --> G1[Customer → Browse, Add to Cart, Checkout]
    G --> G2[Admin → Update Inventory, Process Orders]

4.3. Sequence Diagram

A Sequence Diagram models the interaction between objects arranged in a time sequence. It focuses on the order of messages exchanged between objects to complete a specific functionality.

Key Components:
Purpose:
Example:

In a banking system, the sequence for a money transfer could include:

graph LR
    A[Sequence Diagram] --> B[Shows object interaction over time]
    A --> C[Focuses on order of messages]
    A --> D[Used for scenarios like login, transactions]

    A --> E[Key Components]
    E --> E1[Objects: Top rectangles]
    E --> E2[Lifelines: Vertical dotted lines]
    E --> E3[Messages: Horizontal arrows]
    E --> E4[Activation Bars: Thin rectangles for activity]

    A --> F[Purpose]
    F --> F1[Visualize task execution order]
    F --> F2[Understand dynamic behavior]
    F --> F3[Clarify system component interaction]

    A --> G[Example: Bank Transfer]
    G --> G1[User → AuthService → TransactionService]

4.4. Activity Diagram

An Activity Diagram is a UML behavior diagram used to model workflow or processes. It is similar to a flowchart and shows the sequence of activities and decisions involved in performing a task.

Key Components:
Purpose:
Example:

In a login process:

graph LR
    A[Activity Diagram] --> B["Models Workflow / Processes"]
    A --> C[Similar to Flowchart]
    A --> D[Shows Sequence of Activities & Decisions]

    A --> E[Key Components]
    E --> E1["Initial Node: Start (filled circle)"]
    E --> E2["Activities: Rounded rectangles"]
    E --> E3["Decisions: Diamonds for branches"]
    E --> E4["Forks/Joins: Parallel flows"]
    E --> E5["Final Node: End of flow"]

    A --> F[Purpose]
    F --> F1["Model business processes / algorithms"]
    F --> F2[Show control flow: conditional & parallel]
    F --> F3[Describe use case execution logic]

    A --> G[Example: Login Process]
    G --> G1[Enter Username → Enter Password → Authenticate]
    G --> G2["Valid → Grant Access | Invalid → Display Error"]

5. 1-line Core Object-Oriented Concepts Used in UML

These concepts are used in diagrams like Class, Sequence, and Use Case diagrams.

Concept Meaning
Class Blueprint for creating objects
Object Instance of a class
Inheritance Reuse features from a parent class
Abstraction Show only essential features
Encapsulation Hide internal details to protect data
Polymorphism Same operation behaves differently based on context

6. Popular Tools to Create UML Diagrams