- How does obeying the Open Closed Principle improve the design of our code?
- Why should the open closed principle be used when designing a class?
- Are design patterns still relevant?
- Which design pattern uses Open Closed Principle?
How does obeying the Open Closed Principle improve the design of our code?
The Open Closed Principle is a design principle that states that software components (such as classes and methods) should be open for extension but closed for modification. In other words, it means that you can add new functionality to your software without having to change the existing code.
Why should the open closed principle be used when designing a class?
The general idea of this principle is great. It tells you to write your code so that you will be able to add new functionality without changing the existing code. That prevents situations in which a change to one of your classes also requires you to adapt all depending classes.
Are design patterns still relevant?
Are they still relevant? Quick answer: yes. Especially when you're at the beginning of your journey, design patterns are a good starting point.
Which design pattern uses Open Closed Principle?
The SOLID principles and the Strategy Pattern
The Open-Closed principle is one of the five principles present in the SOLID acronym, it is the letter O.