The Open/Closed Principle states that every module should be open for extension but closed for modification. It is necessary to distinguish between enhancement and extension—enhancement refers to a core improvement of the existing module, while an extension is considered an add-on that provides additional functionality.
The following are the benefits of this principle:
- Existing components can be easily reused to derive new functionalities.
- Components are loosely coupled so it is easier to replace them without affecting the existing functionality.