Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Doubt about fly-weight objects.

by Ctrl-z (Friar)
on May 17, 2005 at 12:24 UTC ( #457767=note: print w/replies, xml ) Need Help??


in reply to Doubt about fly-weight objects.

Also, I'm very curious as to know wether someone has ever met any situation in which it has been useful or sensible to have part of the data "inside" the object and part of it stored in a package lexical: possibly by still using the object's blessed reference as in index into a hash, or by some other technique...

I do this sometimes. Usually when I want private data and the object to behave in public like its underlying blessed type (eg, keys %$obj). This can be more useful than having special key prefixes or other nonsense - but by Software Engineering standards its pretty poor form. Good for quick n' dirty stuff though ;-)




time was, I could move my arms like a bird and...

Replies are listed 'Best First'.
Re^2: Doubt about fly-weight objects.
by blazar (Canon) on May 17, 2005 at 14:20 UTC
    I do this sometimes. Usually when I want private data and the object to behave in public like its underlying blessed type (eg, keys %$obj). This can be more useful than having special key prefixes or other nonsense - but by Software Engineering standards its pretty poor form. Good for quick n' dirty stuff though ;-)
    Interesting. It doesn't seem to me so atrocious after all. Fortunately perl is flexible enough that you can decide what is good and what is evil depending on the problem at hand in each particular situation.

    The problem is that experienced hackers do know when they're doing something that is potentially Bad(TM), and they do on purpose - because they know what they're doing, while occasionally you can see newbies using the same techniques in a totally uninformed matter, which contributes to the spreading of bad programming techniques - what that sometimes in turn contributes to give Perl a bad name...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2020-05-30 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (171 votes). Check out past polls.

    Notices?