Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

The Open/Closed Principle states that "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification".

...

  1. Open for extension: You should be able to add new functionality or behavior to a class or module.

  2. Closed for modification: Once a class or module is developed and tested, the code should not be modified except to correct bugs. Adding new functionality should not involve changing existing code.

...

The idea is to write our components so that we can add new functionality without changing existing code. This prevents potential new bugs in existing functionalities and makes the maintenance of a large codebase easier.

...