Skip to Content.
Sympa Menu

patterns-discussion - Re: [patterns-discussion] About the Collecting Parameter pattern

patterns-discussion AT lists.cs.illinois.edu

Subject: General talk about software patterns

List archive

Re: [patterns-discussion] About the Collecting Parameter pattern


Chronological Thread 
  • From: Jesús Alonso <kenchoweb AT hotmail.com>
  • To: Arno.Haase AT haase-consulting.com
  • Cc: patterns-discussion AT cs.uiuc.edu
  • Subject: Re: [patterns-discussion] About the Collecting Parameter pattern
  • Date: Mon, 18 Apr 2005 10:35:19 +0200
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/patterns-discussion>
  • List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>

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


Hi,

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 UI.

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.

- Arno



Jesús Alonso wrote:
Hello.

I need information about the Collecting Parameter design pattern, but all I could find was the info in this page: http://c2.com/cgi/wiki?CollectingParameter

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.

Best regards,
Jesús Alonso


_______________________________________________
patterns-discussion mailing list
patterns-discussion AT cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/patterns-discussion









Archive powered by MHonArc 2.6.16.

Top of Page