Ticket Management System

Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2025-04-24

Problem Statement

Design a Ticket Management System that allows users to create, assign, track, and resolve tickets related to customer issues, IT requests, or project tasks.


The system should support multiple users (customers, agents, admins), various ticket statuses, and priority levels, while ensuring scalability and clear workflows.


🔹 Problem Context


In organizations or customer support platforms, tickets are used to track issues and service requests.


You are asked to design a modular, object-oriented system that efficiently manages tickets from creation to resolution.


✅ Functional Requirements


Ticket Operations

•Create, update, and close a ticket.
•Each ticket should have:
•Unique ID
•Title, Description
•Status (Open, In-Progress, Resolved, Closed)
•Priority (Low, Medium, High, Critical)
•Creation & Update Timestamps

User Roles

•Customer/User: Can raise and view tickets.
•Agent: Can view assigned tickets and update their status.
•Admin: Can manage all tickets, assign agents, and view reports.

Assignment Logic

•Tickets can be assigned manually by an admin or automatically based on:
•Agent workload
•Ticket category or priority

Notifications

•Notify users/agents when:
•A ticket is created or updated.
•A ticket is assigned or closed.

Search & Filtering

•Search tickets by user, priority, status, or assigned agent.

Audit & History

•Maintain a change log for every ticket (status updates, comments, etc.).


⚙️ Non-Functional Requirements


Aspect with Description


Scalability

Should handle growing number of tickets and users.


Performance

Fast retrieval and updates of tickets.


Reliability

No ticket data loss during concurrent updates.


Extensibility

Support additional workflows (e.g., SLA tracking, escalation).


Maintainability

Well-structured and modular class design.


🧩 Core Classes and Responsibilities

Class and Responsibility


User

Base class for all system users (id, name, email, role).


Customer

Inherits from User; can create and view tickets.


Agent

Inherits from User; can update and resolve assigned tickets.


Admin

Inherits from User; can manage users, assign tickets, and view reports.


Ticket

Represents an issue/request with metadata (id, title, description, status, priority, timestamps).


TicketManager

Handles creation, updates, assignment, and search of tickets.


NotificationService

Sends alerts/updates to users when ticket events occur.


TicketHistory

Maintains logs of all ticket actions and comments.


AssignmentStrategy

Defines how tickets are assigned (manual, load-based, or round-robin).


🧠 Key Design Considerations


•Use Design Patterns such as:
•Strategy Pattern for assignment logic.
•Observer Pattern for notifications.
•Singleton for central TicketManager.
•Ensure thread-safety when multiple agents update tickets concurrently.
•Support persistence abstraction (e.g., save tickets to in-memory DB or file storage).


🧾 Example Scenario


1.A customer creates a new ticket with a description of an issue.
2.The TicketManager assigns it automatically to the least busy agent using the assignment strategy.
3.The agent updates the status to In-Progress, adds a note, and later marks it Resolved.
4.The customer receives notifications at each step.
5.The admin can view system-level statistics like total open/resolved tickets.


🧰 Extension Ideas


•Add SLA timers and automatic escalation policies.
•Enable comment threads and attachments per ticket.
•Integrate with external email or chat APIs for ticket creation.
•Implement a dashboard view for metrics and reporting.


💬 Interview Prompt Summary

Design a Ticket Management System that supports multiple users (customer, agent, admin), allows ticket creation, updates, assignment, and tracking, and includes notifications and history logs.
Focus on object-oriented design, extensibility, and key design patterns like Strategy and Observer.


Solution

Comments