[Phoenix-pm] inside out objects

Michael Friedman friedman at highwire.stanford.edu
Tue Nov 22 22:24:49 PST 2005


So, I just read through _Perl Best Practices_ and it's fantastic.  
It's even well written. And I agree with almost all of Damian's  
recommendations for making more maintainable Perl code... all except  
inside out objects.

However, as I've already had one tranformative religious experience  
from this book (I've changed my braces style), I'm willing to give  
the guy a chance on this one. But I need some more evidence.

Has anyone used inside out objects before? I completely believe that  
they handle encapsulation much better, but what I don't buy is that  
they're actually easier to maintain and equivalently easy to  
understand as the "regular" hash-based objects are.

So, anyone have real world advice on using them?

-- Mike

PS - For those not in the know, inside out objects are identified by  
a unique scalar that acts as an index into a list of hashes, one hash  
for each attribute/field of the object. The values are held in the  
set of hashes in a closure, so absolutely no one but the class itself  
can access them. There is an example in the code block on http:// 
www.windley.com/archives/2005/08/best_practices.shtml, and other  
examples elsewhere that I can't seem to find at the moment. :-(

---------------------------------------------------------------------
Michael Friedman                     HighWire Press
Phone: 650-725-1974                  Stanford University
FAX:   270-721-8034                  <friedman at highwire.stanford.edu>
---------------------------------------------------------------------




More information about the Phoenix-pm mailing list