Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Update: Having found and read this description of Flyweight objects, I noticed first that the equipment being used was a DECstation 3100 (a machine I well remember playing "moonlander" on 16 or more years ago. It was "state-of-the art then and wowed everyone that saw it) and then noticed that the dates on the paper and the references therein were 1987,1988 & 1989. I then realised that this description of flyweight objects comes from a time when it may well have been considered unusual and new, though I don't recall them having a great impact at the time.

Prior to this I was under the impression that "flyweight objects" were being hailed as something new and different, and was intrigued to learned more, but was confused by what I read. Effectively the referenced paper puts that idea to bed and makes the rest of this post redundant.

I'll leave it here as is the apparent preference of the community as testimony that just because you haven't encountered the name of something, that you haven't been unwittingly using it for years. I guess what goes around comes around:^)

End update

Getting by the fact that I was arguing against the example given rather than the definition itself.

Can you explain to me how an object can have extrinsic state?

Using the Glyph example. The text given said that Doc was fast because it used Glyphs, which had no extrinsic state. The example give for what they did not have was position. If you add the position at which a Glyph is displayed or formatted to the Glyph itself, then you do indeed need many more instances than you would without it.

However, if you add the position information to the Glyph class it then becomes intrinsic? But what you now have is no longer a Glyph class, but a Glyph_At_This_Position class. To my way of thinking that just doesn't make sense.

You have a list (small-l) of Positions at which to display Glyphs, and you give the Glyph to the Position not vice-versa. That way, when you reformat to a different page width, you run down the list of Posistions and adjust them and the Glyphs move appropriately. If that means I'm wanting to use Flyweight objects for my Glyphs, then so be it, but it seems like a strange name for the concept and hardly new.

I mean, we build strings from chars, we don't tell a char that it occupies position 7 in this string?


Examine what is said, not who speaks.


In reply to Re: Re^4: Flyweights - different meaning in perl? by BrowserUk
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":



  • 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 scrutinizing the Monastery: (4)
As of 2024-03-28 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found