[Chicago-talk] Proper encapsulation
lembark at wrkhors.com
Sun Feb 13 16:24:57 PST 2005
-- Jim Thomason <thomasoniii at gmail.com>
> It completely 100% utterly totally absolutely violates encapsulation.
> Attributes should be defined within the class period, end of
> discussion. Think about it - if you're defining attributes outside of
> the class, then they're not really encapsulated inside anything, are
> they? :-)
Up to the point where you have to debug something and
have no way to tell what's going on inside the class
even if you need to.
Remember the shotgun approach: Perl asks you to stay
out of its living room because you weren't invited, not
because it has a weapon.
For example, if you can export set/get methods that
check for "_foo" variables (traditionally considered
private) or set something in the object about heavy
privacy then it might make complete sense to export
make the methods available for sane usage (e.g.,
extending the class, debugging, access to values
closures' data in Data::Dumper).
Steven Lembark 85-09 90th Street
Workhorse Computing Woodhaven, NY 11421
lembark at wrkhors.com 1 888 359 3508
More information about the Chicago-talk