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.

EasyTechnical
18 practiced
Compare composition and inheritance in object-oriented design. Describe at least three situations where composition is clearly preferable to class inheritance, and provide a short pseudo-code sketch showing how you would refactor an inheritance-heavy design into composition.
EasyTechnical
18 practiced
Explain the Interface Segregation Principle (ISP). Given an interface 'MultifunctionDevice' with methods print(), scan(), fax(), and email(), describe how you'd redesign it if some clients only need printing and others only scanning. Provide interface examples and explain how ISP improves implementer and client code.
HardSystem Design
22 practiced
Design a language-agnostic server-side API and client SDK strategy for serving machine learning models. Focus on minimal, stable client-facing objects (model, predict request/response), versioned model interfaces, and an extensibility mechanism for custom pre/post processors that does not force breaking changes on SDK consumers.
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
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.

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.