in reply to Re^3: Perl 5 OOP solutions
in thread Perl 5 OOP solutions
The need for strong encapsulation is (IMO) overblown.
I'm pretty sure I wrote the article to which the OP refers (What is Perl 6) and what I meant is that unencapsulated access to attributes in a parent class outside of pure accessors dictates the implementation of descendent classes.
Try subclassing IO::Handle sometime.
I don't particularly care if it's possible for someone clever or committed or crazy to do bad things with the internals of my objects with reflection or XS or ugly hacks. I do care if I have to work around someone else's poor implementation choices because of bad defaults.
Stronger encapsulation keeps the details of the implementation of a class behind an interface, where it belongs.
|
|---|