Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Flyweights - different meaning in perl?

by TheDamian (Priest)
on Dec 19, 2002 at 04:13 UTC ( #221042=note: print w/ replies, xml ) Need Help??


in reply to Flyweights - different meaning in perl?
in thread Yet Another Perl Object Model (Inside Out Objects)

adrianh asked me to comment on this thread.

Yes, the "flyweight objects" described in "OO Perl" are structurally capable of being used as Flyweight Objects (in the Gang of Four sense).

No, the example code shown in "OO Perl" doesn't implement the full flyweight metaphor. Specifically, it doesn't include the necessary constructor code to check if an object already exists (in the logical sense) and so avoid reinstantiating it in that case.

In other words, both sides of this debate were essentially correct. Isn't postmodernism wonderful? ;-)

Why did I stop short of explaining the full technique? Well, even though the changes required to the constructor code would have totalled only a few lines, explaining the concept underlying the full pattern would have required several additional pages of exposition, and I was already 200 pages over my contract limit as it was.

Besides, it was (and still is) my assessment that the most significant application of this type of class is in providing robust, yet maintainable, encapsulation. In Perl at least, its other ability -- to optimize away duplicate value-type objects -- is much less commonly needed.


Comment on Re: Flyweights - different meaning in perl?
Re^2: Flyweights - different meaning in perl?
by adrianh (Chancellor) on Dec 19, 2002 at 08:57 UTC

    Thanks for the comments

    In other words, both sides of this debate were essentially correct. Isn't postmodernism wonderful? ;-)

    <group hug>

    :-)

Re: Re: Flyweights - different meaning in perl?
by demerphq (Chancellor) on Jan 05, 2003 at 23:06 UTC
    would have required several additional pages of exposition, and I was already 200 pages over my contract limit as it was.

    /me patiently waits for the directors cut to be released...

    ;-)

    --- demerphq
    my friends call me, usually because I'm late....

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2014-09-19 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (140 votes), past polls