Problem statement
Design the object model and core APIs for a threaded comment tree of the kind that sits under an article or video, where replies nest arbitrarily deep and moderators soft-delete without orphaning the conversation.
Operating context. Single in-process service. A discussion is a tree of comments rooted at a subject id (an article or video). Each comment has an author, a body, a timestamp, and votes. Users reply to any comment, upvote or downvote, edit their own comments, and collapse a subtree. A moderator soft-deletes a comment, which replaces its body with a tombstone but keeps its replies visible and traversable. A comment's direct children are ordered (by score or by time) and paginated so the client can load more replies on demand. Concurrent replies to the same parent must both attach.
Out of scope. Rich-text rendering and sanitization, spam or abuse detection, notifications and real-time push, and any database or persistence layer.
What to produce. The class hierarchy (comment node, discussion / thread, vote and ordering strategy), the comment lifecycle (visible, edited, soft-deleted tombstone), and the child-ordering and pagination model. Be explicit about: the tree structure and how deep nesting is traversed without a stack overflow, how soft-delete keeps children, how child ordering is a pluggable strategy with pagination, and how concurrent replies to one parent both attach safely.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design LLD
- Media Comments
- Patterns Composite
- Concurrency Locks
- Oop Solid