I had a colleague who told me that he once worked for a company that had a policy of never having conventions ("if" and "switch") in the code and that they allow all decisions in the code to be executed using polymorphism and (I guess) some other principles of OO.
I understand the reasoning that the code is more severe and easier to update, but I'm looking for a more detailed explanation of this concept. Or perhaps this is part of a more general approach to design.
If someone has any resources for this or they will be ready to explain or even have some additional terms related to this, I can use to find more answers that I would be very obliged.
I found one question on SO that was related, but I am not familiar with C ++, so I don't understand too many answers there.
(I'm not an OO guru, but I can handle it)
I am most familiar with PHP, and after that Python, so I would prefer information that uses these languages.
Update: I will ask my colleague to know more about what he had in mind.
Update 2015: after some more years of programming experience, I now see that the goal of this policy was probably to prevent programmers from adding functionality randomly by simply adding conditional expressions (if statements) in certain places. The best way to expand software is to use the Open / Closed Principle , where software is expanded through inheritance and polymorphism. I categorically doubt whether the policy was strictly strict in all conventions, since it could not have passed completely without them.
polymorphism design oop conditional
Niels Bom Aug 31 '11 at 10:16 2011-08-31 22:16
source share