Explain it in 60 seconds
Open/closed principle
Backend Engineering · OOP and Design Patterns · Beginner
What is the open/closed principle?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Open for extension, closed for modification.
- Add behaviour with new code, not edits.
- Use interfaces/polymorphism.
- e.g. new discount type = new class.
- Reduces risk of breaking existing code.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.