12.05 UML Diagram

#UML #class-diagram #usecase-diagram #unit-3
UML Diagrams are a form of modeling language used within software design

They are used for building and refining software architecture based on user requirements

UML is just the modeling language.

class, sequence, collab, usecase

Class Diagram

classDiagram
    class Library {
        -name: String
        -location: String
        +addBook(book: Book)
        +registerMember(member: Member)
    }

    class Book {
        -title: String
        -author: String
        -isbn: String
        -isAvailable: Boolean
        +checkout()
        +returnBook()
    }

    class Member {
        -name: String
        -memberId: String
        +borrowBook(book: Book)
        +returnBook(book: Book)
    }

    class Librarian {
        -employeeId: String
        +manageBooks()
        +assistMember(member: Member)
    }

    Library "1" --> "*" Book
    Library "1" --> "*" Member
    Library "1" --> "*" Librarian
    Member --> Book : borrows >
    Librarian --> Book : manages >

Sequence Diagram

sequenceDiagram
    participant Member
    participant Librarian
    participant Library
    participant Book

    Member->>Librarian: request to borrow(bookId)
    Librarian->>Library: findBook(bookId)
    Library-->>Librarian: book
    Librarian->>Book: checkout()
    Book-->>Librarian: status updated
    Librarian-->>Member: confirm checkout

Collaboration Diagram

sequenceDiagram
    participant Member
    participant Book
    participant Librarian
    participant Library

    Note over Member,Librarian: Collaboration to borrow a book
    Member->>Librarian: Request book
    Librarian->>Library: Lookup book
    Library-->>Librarian: Provide book
    Librarian->>Book: checkout()
    Book-->>Librarian: confirm
    Librarian-->>Member: Hand over book

Use Case Diagram

Pasted image 20250504235324.png|500