Personally, I do not feel comfortable with the idea of using setter and getter functions.Why? Using accessors is pretty much a standard way of accessing object attributes (in many OO languages, to the point that, for example, either Moose or Perl 6 will just write the accessors for you if you kindly ask) and obeying the rules of data encapsulation. Although I do own a copy of Randal's book, I don't have it at hand right away, but I can't remember having read about "inherent" dangers of using accessors. Well, at least, using accessors is much better than fiddling directly with the objects' internal data structure.
In reply to Re: OOP's setter/getter method - is there a way to avoid them?
by Laurent_R
in thread OOP's setter/getter method - is there a way to avoid them?
by tiny_monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |