Interview Q&A / Object-Oriented Programming
Object-Oriented Programming interview questions
The four pillars, interfaces, abstract classes and design basics.
Prefer rapid revision? Practise Object-Oriented Programming short interview answers →
- How does dependency injection make unit testing easier?
Because the class receives its collaborators, a test can pass in a fake instead of a real database, network or clock. The test runs fast and gives the same result every time.
BeginnerQuick answer1 min read - Why do many developers call Singleton an anti-pattern?
It is global state in disguise: hidden dependencies, hard-to-reset state between tests, tight coupling to one concrete class, and trouble when you later need two instances.
IntermediateQuick answer1 min read