The stupid question is the question not asked | |
PerlMonks |
Re: Why get() and set() accessor methods are evilby pg (Canon) |
on Nov 25, 2003 at 17:47 UTC ( [id://309981]=note: print w/replies, xml ) | Need Help?? |
I think:
But your example did make me think. Part of the problem your code showed is that it is not pure OO. Ideally, modification of internal structure shall not cause interface change, but in this case, it caused. Is this caused by using of getter and setter? NO. Now if Perl becomes more OO,
Now whatever you use internally, hash, array or list, the outsider world will see it in the same way (a collection that supports a given set of method, regardless how those method are IMPLEMENTED), and the setter, getter will stay the same. The real problem is that your code is not pure OO, or Perl does not really support you to do it in that way. But the defects showed by your code example does reminder people that, when you do OO design and coding in Perl, there are certain considerations special to Perl that you have to take into consideration.
In Section
Meditations
|
|