http://qs1969.pair.com?node_id=402266


in reply to Re: To use or not to use OO Perl
in thread To use or not to use OO Perl

I always write modules with OO interfaces (instead of exporting functions), but I find that only about 1/5 of my modules actually count as real OO. What does this mean? It means I use new and self, but other than keeping track of instance data, I'm not using any major OO constructs. Just using new means I don't have to pass the same datastructure argument to each function in my module each time. So that's pretty basic. My modules are usually more indicative of functional (do *not* read as "procedural") programming than OO itself.

Code-reuse is not really something that is unique to object oriented development, and it's a shame that people think OO invented code-reuse. It did not. In the wrong hands, OO subclassing actually allows for reuse-avoidance, or even copy-and-paste development in a politically correct format. Furthermore, it is a shame that the philosophy-of-uber-inheritance is so tightly coupled with OO thought that most OO programs instantly grow a tremendous class-hierachy. This too, need not be the case.

Anyhow, OO is fine -- but don't think it's about reuse or maintainability or massive inheritance hierachies or anything like that. It's mostly about state and clean interfaces -- or, at least -- that's how it SHOULD be. The number of real world problems correctly modelled by massive inheritance trees are few and far between.