Read this post in: de_DEes_ESfr_FRid_IDjapl_PLpt_PTru_RUvizh_CNzh_TW

Case Study: Online Library Management System – New User Registration & Book Reservation

Uncategorized20 hours ago

Scenario Description
A new patron (student or member) visits the online library portal to create an account. They provide personal details (name, email, password), the system validates uniqueness (e.g., email not already registered), creates the account in the database, and sends a welcome/activation email. After successful registration, the user searches for a book by title/author, views availability, and reserves it if available (placing a hold). If the book is unavailable, the system offers to notify when it becomes available. The process ends with a confirmation message on the UI.

This flow is common in university/ public library systems and demonstrates user onboarding + core resource interaction.

Key Concepts in UML Sequence Diagrams (Relevant to This Example)

  • Lifeline — Vertical dashed line for participants (e.g., :User, :Browser, :LibraryApp).

  • Message — Arrows for calls: synchronous (solid with filled head →), reply (dashed <–), object creation (dashed arrow to new lifeline with «create»).

  • Activation bar — Shows when an object is processing (activate/deactivate).

  • Alt fragment — Conditional logic (e.g., [registration successful] vs [email already exists]).

  • Opt fragment — Optional behavior (e.g., [user chooses to reserve immediately]).

  • Loop — For iterative actions (e.g., refining search if no results).

  • Actor — The human user (stick figure).

  • Return messages — Dashed arrows carrying results back.

  • Time flows top to bottom.

Participants (lifelines):

  • Patron (Actor)

  • Browser (Frontend/UI)

  • LibraryApp (Application/Controller layer)

  • UserDB (Database for accounts)

  • BookCatalog (Database/service for books and reservations)

  • EmailService (External notification service)

PlantUML Code Example for the Sequence Diagram

This PlantUML script fully represents the case study. It includes account creation, validation, email send, post-registration book search/reservation with alt for availability, and opt for notification.

@startuml
title Online Library – New User Registration & Book Reservation Sequence Diagram
skinparam monochrome true
skinparam shadowing false
skinparam sequenceMessageAlign center
autonumber “[0]”

actor Patron
participant “Browser” as UI
participant “LibraryApp” as App
participant “UserDB” as UserDB
participant “BookCatalog” as Catalog
participant “EmailService” as Email

Patron -> UI: Access registration page
activate UI
UI -> App: submitRegistration(name, email, password)
activate App

App -> UserDB: checkEmailExists(email)
activate UserDB
UserDB –> App: exists = false / true
deactivate UserDB

alt Email Already Exists
App –> UI: returnError(“Email already registered. Please login or use different email.”)
UI –> Patron: Display error message
‘ Removed: destroy App → not needed + caused parser issue in alt branch
else Registration Valid
App -> UserDB: createUserAccount(name, email, hashedPassword)
activate UserDB
UserDB –> App: userId, accountCreated
deactivate UserDB

App -> Email: sendWelcomeEmail(userId, email, activationLink)
activate Email
Email –> App: emailSent
deactivate Email

App –> UI: returnSuccess(“Account created! Check email for activation.”, userId)
UI –> Patron: Show success & redirect to login/dashboard

‘ Post-registration: Book Reservation flow
opt User proceeds to reserve a book
Patron -> UI: Search book (title or author)
UI -> App: searchBooks(query)
activate App

App -> Catalog: queryBooks(query)
activate Catalog
Catalog --> App: listOfBooks (with availability)
deactivate Catalog

alt Books Found
  loop Refine search if needed
    App --> UI: displayResults(booksList)
    UI --> Patron: Show book list
    Patron -> UI: Select book & request reservation
    UI -> App: reserveBook(bookId, userId)
  end

  App -> Catalog: checkAvailability(bookId)
  Catalog --> App: available = true/false

  alt Available
    App -> Catalog: placeHold(bookId, userId, reservationDate)
    activate Catalog
    Catalog --> App: holdPlaced, reservationId
    deactivate Catalog

    App --> UI: displayConfirmation("Book reserved! Pickup when available.")
    UI --> Patron: Show success message
  else Not Available
    App --> UI: offerNotification("Book unavailable. Notify when ready?")
    Patron -> UI: Confirm notification
    UI -> App: subscribeNotification(bookId, userId)
    App -> Catalog: addToWaitlist(bookId, userId)
    Catalog --> App: waitlistAdded
    App --> UI: confirm("Notification set.")
  end
else No Books Found
  App --> UI: displayNoResults("No matches. Try different keywords.")
end
deactivate App

end
end

deactivate UI

@enduml

How to Use This PlantUML Code

  • Paste into https://www.plantuml.com/plantuml/uml/ for instant rendering.

  • In Visual Paradigm Desktop: New Sequence Diagram → Tools → Import → PlantUML → paste → generate & edit visually.

  • In VP Online or AI Chatbot: Use as base in prompts or import for AI refinement.

  • Customize: Add colors (skinparam sequenceArrowThickness 2), participants stereotypes (<<database>>), or remove monochrome for styled output.

Entire Development Path Using Visual Paradigm’s AI Sequence Diagram Support

Step 1: Ideation & Initial Generation (Fastest: AI Chatbot – conversational)

AI Diagram Generation Guide: Instantly Create System Models with Visual Paradigm's AI - Visual Paradigm Guides

  1. Go to chat.visual-paradigm.com.

  2. Use a detailed prompt (or paste the PlantUML above as starting point):

    Generate UML sequence diagram for online library: new user registers with name/email/password, system checks email uniqueness, creates account in DB, sends welcome email. Then user searches/reserves book – if available place hold, else offer waitlist notification. Include alt for duplicate email, opt for reservation after signup, loop for search refinement.

  3. AI outputs visual diagram + PlantUML code. Iterate:

    • “Add activation bars and notes for database operations.”

    • “Make BookCatalog external service with stereotype.”

    • Export PlantUML for next steps.

Step 2: Refine to Layered Architecture (AI Refinement Tool – Desktop)

  1. Launch Visual Paradigm Desktop.

  2. Create/import Sequence Diagram (paste PlantUML → generate).

  3. Tools > Apps > Sequence Diagram Refinement Tool.

  4. Prompt/refine: “Refine this library registration/reservation sequence into layered architecture: separate UI/View, Controller, Service (e.g., UserService, ReservationService), Repository/DB layers.”

  5. AI expands lifelines (e.g., LibraryApp → RegistrationController → UserService → UserRepository; adds detailed calls like hashPassword(), validateInput()).

  6. Edit: Add notes, stereotypes (<>, <>), adjust fragments.

Step 3: Integrate into Documentation & Collaboration (VP Online + OpenDocs)

  1. Access online.visual-paradigm.com → Create OpenDocs page (“Library System – Onboarding & Reservation Flow”).

  2. Insert diagram: Use AI generation or import PlantUML/refined version.

  3. Embed: Add text sections (use case narrative, preconditions like “user not logged in”, postconditions “account active + reservation placed”).

  4. Share: Invite team for comments, track versions.

Step 4: Final Polish & Validation (Desktop Full Editing)

  1. In Desktop: Refine layout (auto-align), enable hierarchical numbering, add return types (e.g., :User user).

  2. Link models: Trace to Use Case Diagram (“Register New Patron”, “Reserve Book”).

  3. Export: PNG/PDF for specs, .vpp project for version control.

This new case study provides a fresh, education-focused example while showcasing Visual Paradigm AI tools for rapid, accurate UML modeling. Render the PlantUML code to visualize it right away—if you’d like variations (e.g., add librarian approval step), just ask!

Free AI Sequence Diagram Refinement Tool - Visual Paradigm AI

 

UML Sequence Diagram  and AI Support

Loading

Signing-in 3 seconds...

Signing-up 3 seconds...