cln.co/
OCP
OCPOpen/Closed Principle

"Open for extension. Closed for modification." - Robert C. Martin

Key Takeaways
  • Add new features without breaking what already works.
  • It's like adding new parts to a toy without taking the old parts apart.
  • This keeps your software safe and simpler to make better over time.

Description

Write code so that you can add new things without changing the old stuff. This means that the behavior of existing entities can be extended without altering the source code, which is already developed and tested.

One of the big headaches in writing software is: adding new features can mess up the existing ones. The more you change old code, the more likely it is that something will break.

A well-designed component allows its behavior to be adapted by creating new code, rather on than changing the component itself, which can lead to software fragility and an increased likelihood of bugs.

You might also like:
ADP
APO
BSR
CCP
CoI
CQS
CRP
DIP
DRY
EUHM
EWV
FF
FTSE
GRASP
HC
HLYW
IH
IoC
IOSP
ISP
KISS
LC
LoD
LOLA
LSP
OCP
POLP
POLS
PoMO
REP
RoT
RTFM
SAP
SDB
SDP
SLA
SoC
SOLDIER
SOLID
SPOT
SRP
TdA
WET
YAGNI
ZOI