[Chicago-talk] Proper encapsulation

Jay Strauss me at heyjay.com
Sat Jan 22 19:07:04 PST 2005

Jim Thomason wrote:
> 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? :-)
> Now then, there are still some novel things that can be done with
> defining attributes outside of the class, so I'm not going to
> discourage them completely because there is reason to do it. I would
> probably frown upon it, though, but I can be persuaded of its uses.
> And hey, this is perl, we can play fast and loose with the rules.
> But if you know what the attributes are going to be in advance (and
> 99.9% of the time you will) and you don't want to add new ones (and
> 99.9% of the tiem you won't), you should always define them in advance
> inside the class.
> -Jim....
Ok, thanks


More information about the Chicago-talk mailing list