Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Class::Flyweight - implement the flyweight pattern in OO perl

by Anonymous Monk
on Jul 09, 2001 at 22:58 UTC ( [id://95104]=note: print w/replies, xml ) Need Help??


in reply to Class::Flyweight - implement the flyweight pattern in OO perl

I don't see very much Flyweight going on here. You may want to call your package Class::Privacy. Explanation: You store a scalar per instance, provided the instance stores a scalar too. No space saved. The Idea of Flyweight is: Many instances store common values (mostly arrays and hashes (or records in other languages)),that are related, as one constant value represented as a pointer (or ref) thereby saving memory, provided they don't modify the pointed to value. Modifyability is achieved by not only storing the pointer but overriding values in the instance too in the hope that many values are common and only a few must be overridden. An instance can modify its value by changing the pointer (and possibly choosing appropriate overrides) too. NOTE: The pointer is not the constant, it's the pointed to value that's constant.
  • Comment on Re: Class::Flyweight - implement the flyweight pattern in OO perl

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://95104]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-23 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found