INFO
These problems require you to design and implement classes that model real-world systems, behaviors, or constraints. They often involve encapsulation, state management, and method orchestration, and are common in low-level design (LLD) interviews.
Classes
Properties
- Focuses on modeling behavior and state through class interfaces
- Requires thoughtful use of constructors, access modifiers, and encapsulation
- Often involves designing multiple interacting classes
- May include constraints like immutability, thread safety, or extensibility
- Encourages use of design patterns (e.g., Singleton, Factory, State)
Common Patterns
- Singleton: Ensure only one instance of a class exists
- Factory: Abstract object creation logic
- Builder: Construct complex objects step-by-step
- State: Encapsulate varying behavior based on internal state
- Strategy: Swap algorithms dynamically via composition
Common Operations
- Define class attributes and methods
- Implement constructors and initialization logic
- Handle edge cases and invalid inputs
- Maintain internal state across method calls
- Support extensibility and testability