[patterns-discussion] About the Collecting Parameter pattern
kenchoweb at hotmail.com
Mon Apr 18 03:35:19 CDT 2005
Thanks for your help. I understand a little better this pattern.
About the book, can't have access to it right now, and I would have to buy
it for just that pattern...
Thanks again for your help
>this pattern solves the problem of how a series of operations can all
>contribute to a collection of results. You could of course have the
>operations return a collection and accumulate the results in the loop that
>calls them, but in e.g. Java methods can have only one return value and
>that may be "in use" for other things.
>A typical use is the gathering of messages, especially error messages. The
>return value of the operations is often in use for the actual "business"
>part of the operations, and the use of exceptions would mean that every
>operation can contribute at most one message.
>Therefore: pass a collection to each operation so that it can contribute
>all the messages. This parameter "collects" the messages, hence the name of
>the pattern. It is useful e.g. for collecting messages to be displayed in a
>It is documented in Kent Beck's "Smalltalk Best Practices" book, wich
>contains a lot of very helpful patterns that are applicable to other
>languages as well.
>Jesús Alonso wrote:
>>I need information about the Collecting Parameter design pattern, but all
>>I could find was the info in this page:
>>The fact is that the information given there about the pattern isn't
>>enough for me to understand very well the pattern.
>>I would find helpful any information about what this pattern does exactly,
>>some examples, and maybe a concrete context where it could be applied
>>successfully and why.
>>Thanks in advance.
>> Jesús Alonso
>>patterns-discussion mailing list
>>patterns-discussion at cs.uiuc.edu
More information about the patterns-discussion