Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I didn't explain myself well enough. The point is that accessors are poor design - they are telling you that you haven't sufficiently thought through the interface.
Let's put it another way: If you expose your attributes through the use of accessors, you have coupled your client to your implementation. Yes, you can have fake accessors like your Area accessor, and that can be a powerful tool. But, I think it's a poor way to have people think about your object. I strongly urge you to take a look at Ruby's Array, Hash, String, and File classes. That is the standard I am now holding myself to when it comes to class design. My criteria for good software:
In reply to Re^3: The Accessor Heresy
by dragonchild
|
|