Design a Low-Level Design (LLD) for an audit system.
An object-oriented design question requiring a scalable, secure, and extensible class structure for logging and auditing actions.
Why Interviewers Ask This
LLD questions assess your ability to translate requirements into code structures. An audit system requires immutability, traceability, and security. The interviewer evaluates your grasp of design patterns, encapsulation, and handling concurrent access.
How to Answer This Question
Identify core entities: User, Action, AuditLog, AuditService. Use interfaces for pluggable storage (file, DB). Ensure thread safety for log writing. Apply the Singleton pattern for the logger instance. Include methods for recording actions with timestamps and metadata.
Key Points to Cover
- Core entity identification
- Interface segregation
- Thread safety mechanisms
- Immutability of records
Sample Answer
I would design an AuditSystem with a central AuditLogger class that acts as a singleton. It would accept an AuditRecord object containing userId, actionType, timestamp, and metadata. The logger would interface with a sto…
Common Mistakes to Avoid
- Tight coupling to specific storage
- Ignoring concurrency issues
- Poor naming conventions
Sound confident on this question in 5 minutes
Answer once and get a 30-second AI critique of your structure, content, and delivery. First attempt is free — no signup needed.