• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

The Command Pattern

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the book "Head First Design Patterns", the author says that a command object "encapsulates a request by binding together a set of actions on a specific receiver."

This statement is confusing to me. What is meant by "binding together a set of actions?" (After I typed it, I suppose I understood it a little better, but I'd like to hear in from a different perspective).

Thanks!
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Brandon Tom:
What is meant by "binding together a set of actions?"




It's the "set of actions" that are bound to the receiver, rather than binding the actions to one another.
The "set of actions" are the operations in the Command's execute() method that are executed against the receiver. So the invoking class doesn�t need to know "how" the command is executed nor "who" the command is executed against.

See also Command Design Pattern
[ April 25, 2006: Message edited by: Peer Reynders ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm finding the "binding ... on a specific receiver" tough to follow. What does that mean?
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stan James:
I'm finding the "binding ... on a specific receiver" tough to follow. What does that mean?



Isn't that even "binding together st. on st."? Frankly, I have no idea what that means.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My wife would blame the "whole language" approach to learning at this point.
"It doesn't have to be perfectly correct, as long as it conveys the intended meaning."
English can be an ambiguous language to begin with (keeping lawyers in a thriving business). Playing it fast and loose doesn't help.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic