Achieved the Open-Closed principle for commands, and independently deployability!!!
This commit is contained in:
parent
2be1478744
commit
f4fef1e9eb
|
@ -10,6 +10,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>rover-commands</artifactId>
|
<artifactId>rover-commands</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
<artifactId>mars-station</artifactId>
|
<artifactId>mars-station</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cat.hack3.codingtests</groupId>
|
||||||
|
<artifactId>rover-commands</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -9,7 +9,6 @@ import static cat.hack3.codingtests.marsrover.ui.console.UICommons.output;
|
||||||
|
|
||||||
public class RoverCommandsPerformer {
|
public class RoverCommandsPerformer {
|
||||||
private final Scanner reader;
|
private final Scanner reader;
|
||||||
private final RotableRiderRover rover;
|
|
||||||
private final MarsRoverCommand moveForwardCommand;
|
private final MarsRoverCommand moveForwardCommand;
|
||||||
private final MarsRoverCommand moveBackwardsCommand;
|
private final MarsRoverCommand moveBackwardsCommand;
|
||||||
private final MarsRoverCommand turnLeftCommand;
|
private final MarsRoverCommand turnLeftCommand;
|
||||||
|
@ -17,7 +16,6 @@ public class RoverCommandsPerformer {
|
||||||
|
|
||||||
public RoverCommandsPerformer(Scanner reader, RotableRiderRover rover) {
|
public RoverCommandsPerformer(Scanner reader, RotableRiderRover rover) {
|
||||||
this.reader = reader;
|
this.reader = reader;
|
||||||
this.rover = rover;
|
|
||||||
moveForwardCommand = new MoveForwardCommand(rover);
|
moveForwardCommand = new MoveForwardCommand(rover);
|
||||||
moveBackwardsCommand = new MoveBackwardsCommand(rover);
|
moveBackwardsCommand = new MoveBackwardsCommand(rover);
|
||||||
turnLeftCommand = new TurnLeftCommand(rover);
|
turnLeftCommand = new TurnLeftCommand(rover);
|
||||||
|
|
Loading…
Reference in New Issue