Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: Re: Re: Method Calls on multiple objects

by dragonchild (Archbishop)
on Mar 27, 2004 at 21:50 UTC ( [id://340307]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Method Calls on multiple objects
in thread Method Calls on multiple objects

If an aggregate served a purpose beyond simple aggregation, that's one thing. But, to create an aggregate class simply to collect things ... that's the red flag. We already have something that collects things - an array. Unless you're spicing up the array somehow, there's no reason to create an additional syntax just to be more OO.

Some reasons I could think for creating an aggregate class:

  • An iterator. Iterators are, at their base, arrays, but they often provide much more than simple iteration. I use them to provide a single interface into various forms of lists.
  • A factory. A factory can also be an aggregate, providing both the ability to create and to iterate. This can be helpful.

Remember - we don't want to go the Smalltalk/Java route where you have a Collection, SortedCollection, Set, Bag, etc. Or, the C++ version where each of those are templated to comply with strong typing. Leverage what exists - don't reinvent the wheel.

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

  • Comment on Re: Re: Re: Re: Re: Method Calls on multiple objects

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Method Calls on multiple objects
by flyingmoose (Priest) on Mar 27, 2004 at 22:17 UTC
    Good, thanks for explaining yourself. My apologies for the knee-jerk reaction, I should have noticed our mutual communication error earlier and pointed it out, but it was a little hard to grok. We are at least 90% on the same page, which for all practical purposes is good enough.

    But, to create an aggregate class simply to collect things ... that's the red flag.

    Then this is why we've had all of this confusion. I had no idea you were pointing out what you considered a red-flag in Limbic's code, rather than mine (I was using map). Thanks for clearing this up. To be fair to Limbic, there are analogous situations where this might make sense, for instance if he was implementing some sort of spiffy event notification list or message dispatch table, in some form or another -- but it would need some tweaking to be that versus what I see in it now.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found