Friday, March 27, 2015

Who does OCP in a purist sense?

I recall a conversation I had with Tim Tonneson in which he spoke of C# project he had heard of secondhand in which the developers embraced the Open/Closed Principle completely, authoring classes, getting them under test, rolling them out in deployments, and then never altering them again in any way. All "revisions" were done through extensions which I'd imagine took the shape of making child classes and having them warp the parent's behavior with inheritance tricks. At some point a child instance would have to replace what was handed into methods in lieu of a parent instance I guess. But Tim didn't suggest firsthand experience with this sort of disciplined approach and I don't have any experience with it either. At all of the places I've yet worked, no one does this. I can remember a presentation I saw John Teague give wherein midstream into a process of steps, whilst showing everyone a projection of his work in Visual Studio, he said something like: "I do have to break the Open/Closed Principal a little here and change this line." That seems like a pretty normal thing to do. A strict adherence to OCP seems almost detrimentally challenging.

No comments:

Post a Comment