Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Indeed I found these links interesting especially in that they show that the concept is not perl-specific as I would have naively thought.

It seems to me that the basic aspect on which most references that were given to me concentrate is that of caching, which supports the actual "light" nature of these objects, as of the name attribution.

However it doesn't seem to me that the typical example one sees about them is really any lighter than "standard" objects. Granted, I see how one could make them so, but that's a different story. Perhaps flyweight objects are really flyweight in other OO {models,languages}.

Note: With the above I mean that the typical perl example of a constructor is:

sub new { my $class = shift; my $id = bless [] => $class; $data{$id} = { foo => undef, bar => undef }; # ... $id; }
or (to speak about Inside-Out):
sub new { my $class = shift; my $id = bless [] => $class; $foo{$id} = undef; $bar{$id} = undef; # ... $id; }
Sometimes one sees \(my $bogus) instead of [], but basically in these typical constructors a unique id is associated to each object, different for all of them.

Side note - OT

While I think that WiKi's such as the referenced one are generally precious resources, I also find their extremely hypertextual nature occasionally confusing and annoying: I tend to have the impression that there may be some relevant node that I missed. Sometimes a slightly more sequential organization would come useful.

Now one -well, I for one- wonders how an ordering could be find (maybe automatically or semiautomatically) in a document that is inherently hypertextual as to make it into a sequential thing...


In reply to Re^2: Doubt about fly-weight objects. by blazar
in thread Doubt about fly-weight objects. by blazar

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (9)
As of 2024-03-28 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found