Getting to know the SOLID principles
In this section, we will formulate answers to the questions corresponding to the five famous design patterns for writing classes – the SOLID principles. By way of a quick remainder, SOLID is an acronym of the following:
- S: Single Responsibility Principle
- O: Open Closed Principle
- L: Liskov's Substitution Principle
- I: Interface Segregation Principle
- D: Dependency Inversion Principle
In interviews, the most common questions pertaining to SOLID are of the What is ...? type. For example, What is S? or What is D? Typically, OOP-related questions are intentionally vague. This way, the interviewer tests your level of knowledge and wants to see whether you request further clarification. So, let's tackle each of these questions in turn and provide an awesome answer that will impress the interviewer.
What is S?
The key points that you should encapsulate in your answer are the following:
- S stands...