Timeline for Following Open Closed Principle
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 22, 2017 at 23:04 | comment | added | Doc Brown | @code4life: the problem with the OCP is that it is badly explained in literature, even by people like Betrand Meyer. See my former answer here: softwareengineering.stackexchange.com/questions/361977/… | |
Dec 22, 2017 at 19:01 | comment | added | code4life | @DocBrown: disagree with your point about OCP being possible through a simple parameter or configuration. That's not what OCP is talking about at all. Bertrand Meyers (yes, the man who invented the term) defines OCP as the base rationale for object inheritance. Another words, he explains that object inheritance was invented to solve this dilemma. So no, a simple parameter or configuration is not what OCP is talking about. OCP is dealing with the question of, how do we extend the capabilities of a closed (aka compiled) module (e.g. DLL) in the most efficacious manner. | |
Dec 21, 2017 at 21:20 | history | edited | candied_orange | CC BY-SA 3.0 |
added 383 characters in body
|
Dec 21, 2017 at 20:55 | comment | added | Doc Brown | If I would go even more into details, I would probably recommend to rewrite large parts of your answer, but that is surely not worth the hassle. And I think we should stop this discussion here, took me already more time than I expected. | |
Dec 21, 2017 at 20:48 | comment | added | candied_orange | @DocBrown Well thanks for the upvote but I'm still curious about how I could improve. I thought I hit on there being many ways to extend and decomposing. | |
Dec 21, 2017 at 20:45 | comment | added | Doc Brown | Not really, only a little bit, I don't see my points adressed. I gave you already an upvote, I think your answer is somewhat better than the accepted one. I still think if I would write an answer here, I could only repeat what I wrote to that other question I linked to in my initial comment, and that is something I won't do. | |
Dec 21, 2017 at 20:33 | comment | added | candied_orange | @DocBrown how about now? | |
Dec 21, 2017 at 20:32 | history | edited | candied_orange | CC BY-SA 3.0 |
added 212 characters in body
|
Dec 21, 2017 at 20:21 | comment | added | Doc Brown | ... second, your answer does not give the OP a clue that inheritance and polymorphism is not the only way to make a class or component more "open for extension". Sometimes a simple parameter or configuration option is all one needs. More important, often decomposing a component into smaller pieces with restricted responsibilities is the best way to implement the OCP. I am sure the OP has not understood this, that is part of his objections against it, and I am under the impression your answer leaves him in this misbelief. | |
Dec 21, 2017 at 20:12 | comment | added | Doc Brown | Well, I think your answer is still neither really bad, nor really good. First, I am convinced the OCP is only a good fit for reusable, generic parts of a program. Trying to apply it to every part instead of generic parts leads easily to overengineering. To be fair, this kind of advice is IMHO equally bad as the other extreme in the currently accepted answer, to avoid applying the OCP. ... | |
Dec 21, 2017 at 20:02 | comment | added | candied_orange | @DocBrown better? | |
Dec 21, 2017 at 20:02 | history | edited | candied_orange | CC BY-SA 3.0 |
added 127 characters in body
|
Dec 21, 2017 at 19:11 | review | Suggested edits | |||
Dec 21, 2017 at 19:51 | |||||
Dec 21, 2017 at 18:23 | history | edited | candied_orange | CC BY-SA 3.0 |
added 209 characters in body
|
Dec 21, 2017 at 17:15 | comment | added | Doc Brown | "A conservative way to apply these principles is to add complexity in reaction to change rather than in anticipation."- to my experience, that is the only way which works well, and I don't think it is conservative, that is actually what YAGNI is about. | |
Dec 21, 2017 at 16:00 | history | answered | candied_orange | CC BY-SA 3.0 |