Learning Platform
Online Education System
Design an online course platform: courses built from modules and lessons, enrollment with prerequisites, per-learner progress, auto-graded quizzes with limited attempts, and a certificate that can be verified.
Overview
An online learning platform lets instructors publish courses and lets learners enroll, work through lessons, take quizzes and earn a certificate. A course is a tree: it holds modules, and modules hold lessons. Each learner moves through the same tree, but their progress is their own.
The problem tests three things. First, whether you model the course tree so that a course, a module and a lesson can all answer the same questions (how long is it, which lessons does it contain) without type checks: this is the Composite pattern. Second, whether you keep the shared course content separate from each learner's progress, so a thousand learners do not copy the course. Third, whether rules such as prerequisites, quiz attempts and 'issue the certificate exactly once' hold when requests arrive at the same time.
A strong answer scopes quickly, draws the tree and the enrollment as separate things, adds question types without touching the quiz code, and shows that a certificate cannot be issued twice or forged.
Scoping the problem
A few minutes of questions fix the shape of the design. Here are seven, with why each matters and the usual answer.
- How deep is the course tree? It is either a fixed depth or a real tree. Use course, module and lesson, and let modules nest.
- Which lesson kinds exist? Video, text and exercise are the candidates. Support all three; they differ in content, not in progress rules.
- How is a lesson completed? By being viewed, or by a passed quiz. A lesson is marked done, and a lesson with a quiz is done when the quiz is passed.
- Which question types, and how many attempts? Grading must be pluggable. Offer single choice, multi select and short answer, with a fixed attempt limit.
- Are prerequisites enforced? They are checked at enrollment. Yes: the prerequisite course must be completed.
- What makes a certificate trustworthy? Anyone can type a code. It must be a code the platform can check and a learner cannot forge.
- Do we need video streaming, payments, reviews? Each is a separate system, so they are out of scope.
Functional requirements
- Courses are trees: a course holds modules, a module holds lessons or other modules
- Lessons are video, text or exercise; a lesson may carry a quiz
- publish() makes a course open for enrollment; it needs at least one lesson
- enroll(user, course) requires every prerequisite course to be completed
- complete_lesson marks a plain lesson done; submit_quiz grades an attempt and marks the lesson done on a pass
- Quizzes support single choice, multi select and short answer, a pass ratio and a limit on attempts
- When every lesson is done the enrollment becomes COMPLETED and a certificate code is issued; verify(user, course, code) checks it
Non-functional requirements
- Course content is shared; each enrollment stores only a set of done lesson ids and attempt counts
- Progress at any level is computed from the tree, never stored twice
- Safe under concurrency: each enrollment has a lock; the certificate is issued exactly once
- A new question type or lesson kind is a new class; Quiz and LearningPlatform do not change
- Certificate codes cannot be forged without the platform secret
Interview questions
- Two requests complete the last lesson at the same moment. How do you avoid two certificates?
- How do you add a new question type, such as a coding exercise with tests?
- How do you stop a learner from forging a certificate code?
- An instructor edits a course after learners have finished half of it. What happens to their progress?
- How would you store this in a database?
Sign up free to read the full topic
More Low-Level Design topics
Start free on Cariara · Coding problems · System design studio