in reply to Re^2: Are lvalue methods (as properties) a good idea?
in thread Are lvalue methods (as properties) a good idea?

Nothing wrong with doing them if you think it all through. But blindly providing getters and setters for all your member variables means you've published your invidual attributes as a public interface for your object, which means that any new version of your object has to support at least that specific interface.

Your public interface should be carefully considered. If some parts of that interface map into a simple setter or getter, fine, do it. But don't do it blindly.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re^3: Are lvalue methods (as properties) a good idea?

Replies are listed 'Best First'.
Re^4: Are lvalue methods (as properties) a good idea?
by Ovid (Cardinal) on Jan 12, 2005 at 22:25 UTC

    That sounds perfectly reasonable and is the best defense I've heard of the Anonymous Monk's assertion. However, I have heard (more than once) comments which suggest that all getters and setters violate encapsulation. Such blanket assertions usually make me very suspicious as to whether or not the person making the statement has really thought things through. Dogma scares me.

    Cheers,
    Ovid

    New address of my CGI Course.