commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <martin.coo...@tumbleweed.com>
Subject RE: [pattern] Command or Closure [was ThrowableHandler]
Date Fri, 09 Aug 2002 00:10:24 GMT


> -----Original Message-----
> From: Stephen Colebourne [mailto:scolebourne@btopenworld.com]
> Sent: Thursday, August 08, 2002 3:36 PM
> To: Jakarta Commons Developers List; Ola Berg
> Subject: [pattern] Command or Closure [was ThrowableHandler]
> 
> 
> What do people read into these two classnames?
> Are they the same, or different?
> Is there a strict computer science meaning?

I was going to type up the definition of a closure from my handy
denotational semantics book, but there are lots of funky symbols that I
don't know how to get into a mail message... ;-{

Here's a Smalltalk oriented description of closures:

http://wiki.cs.uiuc.edu/VisualWorks/Closures

and here's a reference that actually talks about the command pattern and
closures in the same paragraph:

http://www.owlnet.rice.edu/~comp212/99-spring/Tutorials/12/

Here's the relevant text from the latter:

-----
This idea of wrapping a function up in an object is called the command
pattern, and the wrapped-up function is called the command. Sometimes the
object itself is called a closure. Don't worry about the terminology if you
haven't heard it before; just think "command object" when you hear
"closure."
-----

So they're not quite the same thing. So if a 'command' is a function/method
and a 'closure' is an object, I don't know what we call the interface. ;-)

--
Martin Cooper


> 
> I'll confess that I hadn't heard of a Closure until recently, hence my
> choice of Command. However [collections] project used 
> Closure. I'm willing
> to change the classname to Closure if there is a preference for it.
> 
> Stephen
> 
> ----- Original Message -----
> From: "Ola Berg" <ola.berg@arkitema.se>
> To: <commons-dev@jakarta.apache.org>
> Sent: Thursday, August 08, 2002 9:29 PM
> Subject: RE: [pattern] ThrowableHandler
> 
> 
> > >> There is this other pattern called Command, where a Command
> > >> object is an encapsulation of a command call of some sort
> > >> (with parameters and everything), that you use fx when you do
> > >> undo/redo, or implement command queues. Like the State
> > >> pattern for state changes.
> >
> > >That is a closure.
> >
> > Isn\'t is strange then that Closure is recieving objects to 
> handle/act
> upon, instead of encapsulating the Action (that you send to 
> some Machine,
> like in the undo/redo case)? Or am I just plain stupid here?
> >
> > >> BTW, I find the term Closure a bit vague.
> >
> > >Why vague? Closures are a well known construct that have 
> been around for
> a
> > >long, long time. Certainly decades before people started 
> talking about
> > >design patterns.
> >
> > Ah, well I said that the term appeared vague to me, not 
> that it was vague
> in itself ;-) Since I started to program OO professionally 
> first in the late
> 90\'s, I am too young in the business (albeit not on earth) 
> to remember. The
> Command pattern is what I remember (and I never bothered to learn the
> synonyms).
> >
> > /O
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> >
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message