InterviewStack.io LogoInterviewStack.io

Object Oriented Design Principles Questions

Technical principles for designing object oriented systems that are maintainable, extensible, and testable. Topics include single responsibility, open closed, Liskov substitution, interface segregation, and dependency inversion principles; composition versus inheritance trade offs; designing clear and minimal public interfaces and application programming interfaces; separation of concerns, low coupling and high cohesion; use of design patterns where appropriate; strategies for dependency management and dependency injection; and practices that improve testability such as designing for mocking and modularity. Interviewers evaluate ability to reason about class and module boundaries, extensibility, performance and complexity trade offs, and to produce clean code and APIs that support long term maintenance.

HardSystem Design
21 practiced
Design a plugin isolation and sandboxing mechanism to run third-party plugins safely while still allowing them to depend on a limited host API via dependency injection. Discuss process vs thread isolation, native vs language-level sandboxes, capability-based APIs, resource quotas, and monitoring strategies to detect misbehavior.
HardTechnical
19 practiced
You must choose between making an object graph immutable or using defensive copies in a concurrent system with high write throughput. Compare consistency models, latency, memory/Garbage Collection impact, ease of reasoning, and complexity of implementation. Describe how you would implement each approach and what telemetry you'd collect to make an informed decision.
HardTechnical
17 practiced
You're considering replacing runtime polymorphism (virtual dispatch) with static polymorphism or manual conditionals in a tight performance loop. Explain the correctness, maintainability, and performance trade-offs, and provide example alternatives in C++ (templates, CRTP) and Java (sealed classes, switch with pattern matching) including how to measure the impact.
HardTechnical
32 practiced
You must add a new cross-cutting behavior (audit logging) across many unrelated classes without modifying each class. Evaluate the use of Visitor, Decorator, Proxy, and AOP approaches. For each approach propose an implementation sketch, discuss runtime performance and LSP impacts, and describe how you'd test the added behavior.
HardTechnical
31 practiced
A widely used public class exposes public mutable fields that many clients access directly. You must introduce encapsulation, validation, and invariants without breaking existing clients. Present a migration plan that preserves behavior (both binary and semantic compatibility), including wrappers, deprecation strategies, adapters, and rollout steps with examples.

Unlock Full Question Bank

Get access to hundreds of Object Oriented Design Principles interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.