|Perl: the Markov chain saw|
A new take on affordance.by frankus (Priest)
|on May 16, 2002 at 13:09 UTC||Need Help??|
I've recently been writing Perl objects until they come out of my ears. This has meant a great deal of re-reading of Mr Conways book, and a lot of soul-searching as to which aspects to keep and which are over-engineering for the requirements and the platform.
Since Perl's implementation of OO is commonly used with a hash, one hash for a class and all it's 'parents'. To avoid collision between names of inherited attributes a namespace is defined for each package and prepended to the attributes of an object. This is a poor summary of section 6.2.6 of OO Perl by Damian Donway.
Well it set me to thinking, that since I was brought up believing all properties of an object should be viewed through accessor methods, and altered through mutator methods, one way of achieving this was to slap on a long namespace to stop people tampering, it seemed a little more dictatorial than the '_' affordance, although I stuck to that too.
My reasoning being, the the major reason for people using the properties rather than the accessors, which might perform other duties, was mis-placed laziness.
Obviously, I hope, you can see that I've exagerated the length of the property, but does this makes sense to use? I really am in two minds as to whether this is a good thing, so I thought I'd post it here as people have some pretty strong views on OO...