Design a Chatbot with Object-Oriented Principles

Quick Overview

Study an extensible object-oriented chatbot design with clean entities, replaceable providers, streaming states, and testable boundaries.

Design a Chatbot with Object-Oriented Principles

Company: OpenAI

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

# Design a Chatbot with Object-Oriented Principles Create an object-oriented design for a chatbot system. Define the responsibilities and relationships needed to manage conversations, participants, messages, delivery, and provider-specific model behavior without coupling every class to one implementation. ### Constraints & Assumptions - Focus on domain and interface design rather than distributed deployment scale. - A conversation contains ordered messages and may receive streamed assistant output. - The design should permit a model provider or storage adapter to be replaced. ### Clarifying Questions to Ask - Can multiple users participate in one conversation? - Must message edits or retries be retained? - Is streaming part of the domain contract or an adapter concern? ```hint Assign ownership Give each object one reason to change and keep infrastructure behind interfaces. ``` ### What a Strong Answer Covers - Core entities, invariants, and object relationships. - Interfaces for generation, storage, delivery, and observability. - Conversation ordering, retries, cancellation, and partial streamed messages. - Extension points and tests that avoid a monolithic manager class. ### Follow-up Questions 1. How would you add tool calls without changing every existing message type? 2. Where would authorization checks belong?

Quick Answer: Study an extensible object-oriented chatbot design with clean entities, replaceable providers, streaming states, and testable boundaries.

|Home/Software Engineering Fundamentals/OpenAI
OpenAI logo
OpenAI
Aug 24, 2026
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
2
0

Design a Chatbot with Object-Oriented Principles

Create an object-oriented design for a chatbot system. Define the responsibilities and relationships needed to manage conversations, participants, messages, delivery, and provider-specific model behavior without coupling every class to one implementation.

Constraints & Assumptions

  • Focus on domain and interface design rather than distributed deployment scale.
  • A conversation contains ordered messages and may receive streamed assistant output.
  • The design should permit a model provider or storage adapter to be replaced.

Clarifying Questions to Ask Guidance

  • Can multiple users participate in one conversation?
  • Must message edits or retries be retained?
  • Is streaming part of the domain contract or an adapter concern?

What a Strong Answer Covers Guidance

  • Core entities, invariants, and object relationships.
  • Interfaces for generation, storage, delivery, and observability.
  • Conversation ordering, retries, cancellation, and partial streamed messages.
  • Extension points and tests that avoid a monolithic manager class.

Follow-up Questions Guidance

  1. How would you add tool calls without changing every existing message type?
  2. Where would authorization checks belong?
Loading comments...