Medium
Stack Overflow

Design a Question and Answer Platform Object-Oriented Design Interview

Design a Q&A platform domain model with users, questions, answers, comments, tags, votes, an accepted-answer rule, and a reputation policy, with the voting, acceptance, and reputation invariants enforced in the model.

1. Problem Statement

Design a question-and-answer platform where users post questions and answers, add comments and tags, vote posts up or down, and the question's author accepts one answer. Reputation changes with votes and acceptance. Start by clarifying scope and the core objects.

2. Live Coding Format

Work in the provided coding workspace while explaining your decisions to the live interviewer. Validation may use inline tests, examples, comments, or a verbal walkthrough.

3. Key Focus Areas

  • 1
    Post abstraction shared by Question and Answer
  • 2
    Voting invariants (one per user, replace on change, no self-vote)
  • 3
    Accepted-answer rule and authorization
  • 4
    ReputationPolicy strategy and reputation ledger ownership

4. What Strong Candidates Should Demonstrate

  • Model Users, Questions, Answers, Comments, Tags, and Votes with a shared Post abstraction.
  • Enforce one-vote-per-user, no-self-vote, and single-accepted-answer invariants in the model.
  • Restrict answer acceptance to the question's author.
  • Encapsulate reputation changes behind a replaceable policy.

Want interactive feedback?

Practice this problem in the live coding workspace while the interviewer probes your clarification, implementation, trade-offs, and validation.

Continue to Dashboard

Core Concepts

Object-Oriented DesignDomain ModelingInvariant EnforcementStrategy Pattern

Continue preparing

Build a complete software engineer mock interview plan

Related Object-Oriented Design

Design a Car Rental System

Design a car rental domain model covering vehicle categories and vehicles, branches, customers and drivers, a rental date range, rate-based quotes, reservations, pickup rental agreements, and return inspection with extra charges — preventing overlapping rentals of the same vehicle.

Related Object-Oriented Design

Design a Library Management System

Design a library that models catalog titles versus physical copies, members and librarians, checkout/return/renew/reserve flows with loan due dates, an overdue fine policy, and notifications as a boundary.

Related Object-Oriented Design

Design a Rare Book Condition Management System

Model the core domain objects for tracking physical condition assessments of rare library books, with immutable scan history and structured condition report generation.

Related Object-Oriented Design

Design a Restaurant Management System

Design a restaurant domain model covering tables and capacity, reservations for time slots, seated parties, a menu, orders with priced line items, kitchen status, and bills with payments, keeping booking and order/kitchen state transitions correct.