O Open Closed Principle OCP
3 sectionsRapid overview
Open Closed Principle (OCP)
TL;DR
OCP says you should be able to add new behaviour by writing new code, not by editing the code that already works. In practice that means programming against interfaces (payment processors, strategy objects, plugin registries) so a new varia…
Read →How it works
> "Software entities should be open for extension but closed for modification."
Read →Quick recall Q&A
Q: How do you ensure new features don't require modifying existing code in React? A: Use composition, custom hooks with dependency injection, and strategy patterns. Pass dependencies as props or via context so components depend on abstracti…
Read →