LLD-6 Meeting Scheduler
In this article, we will discuss and try to design a meeting scheduler.
Problem Statement:
- Given (n) meeting rooms. Users can book any meeting room from (start time to end time) if the room is available.
- If a room is not available, it should be shown at that moment only.
- All the participants of a meeting should receive a notification related to the same.
- Use the calendar for tracking dates and times.
- Store the history of all the meetings scheduled.
- Users can see all the available meeting rooms for a particular time slot ( can be neglected for implementation but is good to discuss)
A few other points that can be discussed during the interview…
- Room Assignment (different strategies)
- User availability (how to check which user is available at what time)
- What kind of meetings will be there (recurrence or one time)
- Capacity of meeting rooms
- A calendar can be specific to user profiles and meeting rooms, which to consider.
For this discussion, we are considering
- Capacity of meeting rooms
- The calendar should be specific to a meeting room.
- The meeting invite should be one time.
- Assume attendees are available for the meeting.
- Consider room assignment strategy to be FCFS.
Entities:
Now, let's discover entities from the requirements mentioned above.
- Meeting
2. Meeting Room
3. Meeting Scheduler
4. Calendar
5. Time Slot
6. User (Host, Attendee)
7. RoomAssigning Strategy (Interface)
8. Meeting Observable (Interface)
9. Notification Observer (Interface)
All the entities considered are easy to think and understand. Few things that I want to highlight here:
- Since each attendee in the meeting needs to be notified, we need to send a notification for that. The Observer Design Pattern best fits the use case. Thus, we have the INotificationObserver interface, which has the SendNotificationToUser method. A Notification Observer is no one but a User (participant in the meeting)
- A notification is sent for a meeting. Thus, a meeting scheduler is responsible for sending notifications for a particular meeting.
- In the Observer design pattern, there is one observer (who is looking for something) and there is one observable ( the thing someone is looking for). In our case, the Observable is Meeting. Thus, we have IMeetingObservable which has the method NotifyUsers, which every meeting object should follow.
- To find the best possible room based on a time slot, we can have different strategies for that. A meeting scheduler is responsible for finding the room for a meeting, thus it should have an object for room assignment strategy. We have the IRoomAssignmentStrategy interface, which has the BookRoom method. Each type of Assignment strategy should implement this method.
Note: I have not made class diagram, activity diagram as they can be easily created and visualized from the entities mentioned above.
Now, let’s see the main function
GitHub Code Repo ✍️:
Follow for more on LinkedIn✌🏻💁