InterviewDB Question

CRM System - Object-Oriented Design for a Customer Relationship Manager

Question Details

Round 1 OOD / Coding

Problem

Design the core of a CRM system. The system tracks Contacts, Companies, and Deals. A Contact belongs to a Company. A Deal has an associated Contact, a value, and a stage (LEAD, QUALIFIED, CLOSED_WON, CLOSED_LOST). Implement the following:

python
class CRMSystem:
    def add_company(self, company_id: str, name: str) -> None: ...
    def add_contact(self, contact_id: str, name: str, company_id: str) -> None: ...
    def create_deal(self, deal_id: str, contact_id: str, value: float) -> None: ...
    def advance_stage(self, deal_id: str) -> str: ...
    def total_pipeline_value(self, stage: str) -> float: ...
    def deals_for_company(self, company_id: str) -> list[dict]: ...

Example

crm.add_company("c1", "Acme")
crm.add_contact("p1", "Alice", "c1")
crm.create_deal("d1", "p1", 10000.0)   # stage = LEAD
crm.advance_stage("d1")                # -> "QUALIFIED"
crm.total_pipeline_value("QUALIFIED")  # -> 10000.0
crm.deals_for_company("c1")            # -> [{deal_id, value, stage, contact}]

Follow-ups

  1. How would you implement deal history so you can see when each stage transition happened?
  2. A contact can move to a different company — how does that affect existing deals?
  3. Design an activity log (calls, emails, notes) attached to deals or contacts.
  4. How would you generate a sales funnel report showing conversion rates between stages?

Full Details

Round 1 OOD / Coding

Problem

Design the core of a CRM system. The system tracks Contacts, Companies, and Deals. A Contact belongs to a Company. A Deal has an associated Contact, a value, and a stage (LEAD, QUALIFIED, CLOSED_WON, CLOSED_LOST). Implement the following:

python
class CRMSystem:
    def add_company(self, company_id: str, name: str) -> None: ...
    def add_contact(self, contact_id: str, name: str, company_id: str) -> None: ...
    def create_deal(self, deal_id: str, contact_id: str, value: float) -> None: ...
    def advance_stage(self, deal_id: str) -> str: ...
    def total_pipeline_value(self, stage: str) -> float: ...
    def deals_for_company(self, company_id: str) -> list[dict]: ...

Example

crm.add_company("c1", "Acme")
crm.add_contact("p1", "Alice", "c1")
crm.create_deal("d1", "p1", 10000.0)   # stage = LEAD
crm.advance_stage("d1")                # -> "QUALIFIED"
crm.total_pipeline_value("QUALIFIED")  # -> 10000.0
crm.deals_for_company("c1")            # -> [{deal_id, value, stage, contact}]

Follow-ups

  1. How would you implement deal history so you can see when each stage transition happened?
  2. A contact can move to a different company — how does that affect existing deals?
  3. Design an activity log (calls, emails, notes) attached to deals or contacts.
  4. How would you generate a sales funnel report showing conversion rates between stages?

About This Question

This is a reported interview question from a reevo interview during the onsite round.

It covers the following topics: Coding, Oop, Onsite .