DEV Community

Discussion on: The Command Pattern in Java

Collapse
 
solomea profile image
Solomea

Where did this light came from? We need to put the HeatingSystem in constructor, but u are doing this:
HeatingSystem heatingSystem = new HeatingSystem();
and then putting light HeatingSystem out of nowhere
Command heatOn = new HeatingOnCommand(light);
Command heatOff = new HeatingOffCommand(light);