Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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

by Anonymous Monk
on Jul 09, 2001 at 22:58 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2016-10-21 00:59 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (284 votes). Check out past polls.