in reply to Why get() and set() accessor methods are evil
Hi,
I wrote-up something along these lines a while ago for perldesignpatterns.com. Other things have been written in the past too. Off the top of my head, the major gripes people have with put-get accessors (not lvalue or tied interface) are:
-scott
I wrote-up something along these lines a while ago for perldesignpatterns.com. Other things have been written in the past too. Off the top of my head, the major gripes people have with put-get accessors (not lvalue or tied interface) are:
- -> becomes the only useful operator. + becomes foo->add() or foo.add().
- Side effect of above: incrementing or any += style operator becomes particularly painful
- The rich interfaces of hashes and arrays is lost when implementing datastructures as objects, an extremely common case
-scott
|
---|
In Section
Meditations