Keep It Simple, Stupid | |
PerlMonks |
Re^2: Language design: direct attribute access and postponed mutators (Perl Vs Python)by LanX (Saint) |
on Sep 16, 2019 at 20:11 UTC ( [id://11106258]=note: print w/replies, xml ) | Need Help?? |
True, but the OP wasn't about hiding private attributes, but about maintaining public attributes. Once you've exposed an attribute in the API and and external code is accessing it directly, it becomes complicated to realize "a man in the middle" layer functioning as getter and setters. Classic (a bit contrived) example is an attribute .name which needs at some point to evolve to a getter name() returning a concat of .firstname and .lastname (and probably .middlename) without breaking old code.
Cheers Rolf
In Section
Meditations
|
|