Low Level Design & OOP
Design and Implement an In-Memory Tally Service
Asked by:Meta
concurrencyinterfacesobject_modelingstate_managementtesting
Problem Overview & Object Oriented Requirements
Design a thread-safe, bounded-memory counter that records timestamped events and answers exact inclusive range queries quickly.
Design Principles: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion (SOLID).
Topics & Patterns: concurrency, interfaces, object_modeling, state_management, testing.
Class Design Breakdown
1. Identify Core Entities
List primary objects, state enums, value objects, and domain controllers.
2. Class Relationships
Define inheritance, composition, aggregation, and interface abstractions.
3. Apply Design Patterns
Incorporate Strategy, Factory, Observer, State, or Decorator design patterns.
4. Concurrency & Extensibility
Handle thread locks, synchronization, and future extensions cleanly.