Open/Closed Principle

Said Olano - Nov 4 '23 - - Dev Community

Software entities (e.g. classes) should be open for extension, but closed for modification. I.e. such an entity can allow its behavior to be modified without altering its source code.

  • Write classes that can be extended (as opposed to classes that can be modified).
  • Expose only the moving parts that need to change, hide everything else.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .