in reply to Re: Make Perl an OO language
in thread Make Perl an OO language
I don't like perlboot, since it makes the all-too-common mistake for OO introductions of stressing inheritance to the point of making it seem like the whole point of OO is inheritance.
I do lots of OO programming and I don't use much inheritance. And when I do use inheritance, it is almost always interface inheritance using a purely virtual class that simply defines an interface and includes no implementation.
Unfortunately, Perl OO doesn't really support interfaces (unless you consider a simple list of method names to be an interface) so this type of inheritance is pretty pointless in Perl.
So I find inheritance to usually be the wrong answer in Perl. And yet I find lots of people who decide to "go the OO route" in Perl and immediately start thinking "what should inherit from what here?"
The point of OO, especially in Perl, is to nicely wrap all of your related data up into a convenient package that also knows the things that you can do with that data.
I find that if I'm writing a module, then it is best to just write it using OO, no matter how small it starts out to be. Without even thinking about it, you'll likely end up with a module that is much more robust in the face of being used from multiple parts of the same program and yet has a much lower risk of namespace collisions.
- tye
|
---|
Replies are listed 'Best First'. | |
---|---|
•Re: (tye)Re: Make Perl an OO language
by merlyn (Sage) on Oct 29, 2002 at 21:14 UTC | |
by tye (Sage) on Oct 29, 2002 at 22:07 UTC | |
by ichimunki (Priest) on Oct 29, 2002 at 23:23 UTC |