Hacker News new | ask | show | jobs
by btn 5804 days ago
The author seems to misunderstand the open-closed principle, and his first example confuses bug-fixing with API modification. The open-closed principle is designed to promote API stability and reduce errors caused by API contract changes that cascade to its users. A class should expose an interface that allows for such contract changes to be encapsulated in subclasses. This is not a "debunked" or "outdated" idea, especially if you are designing APIs for public consumption.

Then there's a bunch of stuff about properties that seems to go around in a circle...

It seems that his rationale for this rant stems from poor API design by others---where class modification through sub-classing is impossible to achieve because of opaque interfaces. This has nothing to do with people using private variables, and all to do with people not designing proper and extensible interfaces.