in reply to Re: Make your classes use their own methods
in thread Make your classes use their own methods

I certainly am not saying that you should always have accessors. What I AM saying is that if you DO have them then you should ALWAYS use them. They are no more difficult to use than direct member access.

xoxo,
Andy

  • Comment on Re: Re: Make your classes use their own methods

Replies are listed 'Best First'.
Re: Re: Re: Make your classes use their own methods
by Jenda (Abbot) on Nov 24, 2003 at 22:40 UTC

    Well sometimes they are a bit harder to use

    $selt->{count}++; $selt->count++; # I guess that's not gonna fly. # Except maybe if you do something spicy with LHS subroutines.
    But that's not the point. They are much slower. Therefore even if you force (politely ask) the outside world to use the accessors you may not want to use them inside the class. Of course you should be aware of the consequences :-)

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature