Member-only story

How to build a Calendar: Whiteboard Sketch

Dingding Wang
7 min readAug 6, 2019

--

Calendar is important in my daily life. It frees part of my brain from remembering tedious scheduled tasks and makes it easier to manage my time. As an engineer who use google calendar heavily, I’m intereted of how such calendar system is built from zero and upgraded with more features. Here I put some of my studies below.

Calendar MVP: personal offline calendar

  1. Functions:

Very simple calendar should at least suppot the followings:

  • Add, remove, edit a calendar event.
  • When one calendar event is close by, notify user.
  • Pull calendar for this week, next week or this month.

2. Data Structure

Now let’s consider which data structure is suitable to store calendar events, while making each of the operation fast.

It’s natural that we would use dictionary to store event keys, each of them maps to an event object, for easy lookup and editing. And at the same time, keep an index with events sorted by (start_time, end_time), so that when timer traverses through, it notifies user whener it meets an event.

When user wants to see schedule of the week, just return the sublist of Event List formatted with event details to frontend.

--

--

Dingding Wang
Dingding Wang

Written by Dingding Wang

Former Yelper, now a Snapchatter. Focus on Payment transaction system, Search system, Web API server and Internationalization.

No responses yet