Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Ok. First off in general I agree with most of what your saying. But I think that you have slightly missed my point.

I think the crux of the matter is highlighted in these two sentences

    Note we are not removing any duplicate state. We are moving state from the object to that objects class.

    The motivation for doing it is data-hiding, not reducing duplicate state.

The point I was trying to make was with the flyweight pattern as described by TheDamian we can do both of these things. The overall design facilitates it much more than most other OO perl models i've seen.

(I think you do have to read that "allows" as meaning that objects are reused - otherwise it's just a null statement)

This one of the few points where I do disagree with you. I think the allows is crucial. Sharing objects in perl in the way that they mean here is not particularly convenient. However sharing attribute data is. And as I think the core objective is to reduce overhead by sharing data, the particular mechanism by which this is effected is not particularly relevent. And the flyweight pattern allows this to be done in an easier way than most other object models.

Lets put it this way, if you or I sat down to implement a flyweight object system, or a shared attribute system, we would end up with an implementation that is basically the same as TheDamians.

Here we talk about sharing objects with the same state. The motivation is to reduce the overhead in having a multitude of objects.

No. The motivation is to reduce overhead by not duplicating data. Sharing objects is just an means to an end.

I agree however that this debate has degenerated ;-) into quibbles. However for me (and I think you too) its been a fun and educational trip.

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


In reply to Re: Re^6: Flyweights - different meaning in perl? by demerphq
in thread Yet Another Perl Object Model (Inside Out Objects) by demerphq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (6)
    As of 2014-11-23 17:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (134 votes), past polls