Meeting Room Scheduler - List Bookings
What is the Meeting Room Scheduler - List Bookings Problem?
Section titled “What is the Meeting Room Scheduler - List Bookings Problem?”Design a Meeting Room Scheduler system that allows users to list, filter, sort, search, and export bookings. The system should support listing bookings by room, user, or time period; filtering by multiple criteria; sorting by different attributes; searching by keywords; pagination for large datasets; and exporting booking lists in various formats. The system should also visualize conflicting bookings.
In this problem, you’ll design a system that efficiently manages and presents booking data with complex querying capabilities, demonstrating how to handle large datasets with pagination and provide flexible filtering and sorting mechanisms.
Problem Overview
Section titled “Problem Overview”Design a comprehensive booking management system that provides efficient querying, filtering, sorting, searching, and export capabilities for meeting room reservations.
Core Requirements
Section titled “Core Requirements”Functional Requirements:
- Booking Listing: List all bookings for a specific room, user/organizer, or time period.
- Filtering: Filter bookings by room, user/organizer, date range, and booking status. Multiple filters can be applied simultaneously.
- Sorting: Sort bookings by start time, room name, or organizer name in ascending or descending order.
- Search: Search bookings by keywords that match booking titles, participant names, or room names (case-insensitive).
- Booking Details: Display detailed information including booking ID, room name, organizer, participants, start time, end time, and status.
- Conflict Visualization: Identify and visually mark bookings with overlapping time slots for the same room.
- Export: Export booking lists in CSV and JSON formats, including all filtered/sorted/search results.
- Pagination: Handle large datasets with configurable page size and navigation controls (next, previous, first, last page).
Non-Functional Requirements:
- Object-Oriented Design: Clear separation of concerns with well-defined roles for each class.
- Modularity: Easy to add new filtering criteria, sorting options, or export formats without modifying existing code.
- Thread Safety: Listing, filtering, sorting, and pagination operations must be safe from race conditions.
- Performance: Efficiently handle large datasets (thousands of bookings) with optimized operations.
- Extensibility: Core listing logic should be robust, testable, and maintainable over time.
What’s Expected?
Section titled “What’s Expected?”1. System Architecture
Section titled “1. System Architecture”The system provides a service layer for querying and managing booking data.
2. Key Classes to Design
Section titled “2. Key Classes to Design”classDiagram
class BookingListService {
-Map~String,Booking~ bookings
-FilterStrategy filters
-SortStrategy sortStrategy
+listBookings(...)
+filterBookings(...)
+sortBookings(...)
+createIterator(...)
}
class FilterStrategy {
<<interface>>
+matches(Booking)
}
class SortStrategy {
<<interface>>
+compare(Booking, Booking)
}
class BookingIterator {
<<interface>>
+hasNext()
+next()
+getCurrentPage()
}
class Booking {
-String id
-MeetingRoom room
-User organizer
-DateTime startTime
-DateTime endTime
}
BookingListService --> FilterStrategy
BookingListService --> SortStrategy
BookingListService --> BookingIterator
BookingListService --> Booking
System Flow
Section titled “System Flow”Query Flow (Filter → Sort → Paginate)
Section titled “Query Flow (Filter → Sort → Paginate)”Key Design Challenges
Section titled “Key Design Challenges”1. Efficient Pagination for Large Datasets
Section titled “1. Efficient Pagination for Large Datasets”When dealing with thousands of bookings, loading all data into memory is inefficient.
Solution: Use the Iterator Pattern. Create a PaginatedBookingIterator that maintains current page, page size, and total pages. The iterator provides methods to navigate through pages without loading all data at once. This supports lazy loading and efficient memory usage.
2. Flexible Filtering and Sorting
Section titled “2. Flexible Filtering and Sorting”Users need to filter by multiple criteria (room, user, date range, status) and sort by different attributes (time, room, user).
Solution: Use the Strategy Pattern. Create separate strategy classes for each filtering criterion (RoomFilterStrategy, UserFilterStrategy, DateRangeFilterStrategy, StatusFilterStrategy) and sorting option (SortByTimeStrategy, SortByRoomStrategy, SortByUserStrategy). Multiple filters can be combined (AND logic), and sorting strategies can be swapped at runtime.
3. Thread-Safe Concurrent Access
Section titled “3. Thread-Safe Concurrent Access”Multiple users might query bookings simultaneously, requiring thread-safe operations.
Solution: Use synchronized blocks or locks in all state-changing methods. Use ConcurrentHashMap for thread-safe storage. Ensure iterator operations are thread-safe to prevent concurrent modification exceptions.
4. Conflict Detection
Section titled “4. Conflict Detection”Identify bookings with overlapping time slots for the same room.
Solution: Create a ConflictDetector that checks for overlaps by comparing time ranges. Two bookings conflict if they are for the same room and their time slots overlap (start1 < end2 AND end1 > start2).
What You’ll Learn
Section titled “What You’ll Learn”By solving this problem, you’ll master:
- ✅ Iterator Pattern - Implementing pagination for efficient data traversal.
- ✅ Strategy Pattern - Encapsulating filtering and sorting algorithms for extensibility.
- ✅ Concurrency Control - Ensuring thread-safe operations in multi-user environments.
- ✅ Export Functionality - Supporting multiple export formats with extensible design.
- ✅ Search Functionality - Implementing keyword search across multiple fields.
View Complete Solution & Practice
Section titled “View Complete Solution & Practice”Ready to see the full implementation? Open the interactive playground to access:
- 🎯 Step-by-step guidance through the 4-step LLD approach
- 📊 Interactive UML builder to visualize your design
- 💻 Complete Code Solutions in Python, Java, C++, TypeScript, JavaScript, C#
- 🤖 AI-powered review of your design and code
Related Problems
Section titled “Related Problems”After mastering the Meeting Room Scheduler - List Bookings, try these similar problems:
- Meeting Room Reservation System - Focus on booking creation, conflict detection, and notifications.
- Task Management System - Similar filtering, sorting, and pagination requirements.
- Library Management System - Querying and listing resources with filters and pagination.