cxlove / DesignPattern

The example code from head first design patterns for practicing
0 stars 2 forks source link

The Command Pattern using Java #12

Open cxlove opened 8 years ago

cxlove commented 8 years ago

RT

cxlove commented 8 years ago

Step 1: A simple remote control assemble single command

We build a Command Interface with a public method called execute(). And implement it by packaging the action and receiver.

And the controller can assemble the command object to call the execute method.

cxlove commented 8 years ago

Step 2: Multiple remote control with multiple command

cxlove commented 8 years ago

Step 3: add undo button, using a stack to record action have been executed