Closed keanecjy closed 3 years ago
- What does the receiver do in the Command pattern?
The thing the command will act on (if any).
2. In the context of AB3, is the Receiver the Model class or the Person class for the AddCommand?
You can check (I can't remember) what thing is being given to commands to act on. Some command might not need any e.g., the HelpCommand
- In the context of AB3, is the Receiver the Model class or the Person class for the AddCommand?
You can check (I can't remember) what thing is being given to commands to act on. Some command might not need any e.g., the HelpCommand
Must it be part of the constructor parameter? Or can it be a parameter during the execute method?
This is because Person
is passed in as the constructor parameter, and Model
is passed in in the execute method. In this case, are both classes considered acted on?
Must it be part of the constructor parameter? Or can it be a parameter during the execute method? This is because
Person
is passed in as the constructor parameter, andModel
is passed in in the execute method. In this case, are both classes considered acted on?
All of these are acceptable ways of connecting the receiver(s) to the command.
Ok thank you @damithc