Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Loïc Faugeron:
Mars Rover, Driving instruction
Aug 17, 2016 @ 14:47:01

Loïc Faugeron continues his series of "Mars Rover" posts with this new article focusing on a refactor of the currently defined method of "driving" the rover.

In this series we're building the software of a Mars Rover, according to the following specifications. It allows us to practice the followings: Monolithic Repositories (MonoRepo), Command / Query Responsibility Segregation (CQRS), Event Sourcing (ES) [and] Test Driven Development (TDD).

We've already developed the first use case about landing the rover on mars, and we've started the second one about driving it. [...] In this article we're going to refactor DriveRover

He points out the reason for the refactor: there could be a desire to have more that one driving instruction in the list to execute. He starts by using phpspec to define the "Instruction" class and some tests to ensure the different directions are handled. He then moves over to the "Instruction" test and moves the code from the "DriveRover" class into it, including the valid driving directions.

tagged: mars rover tutorial series driving instruction refactor phpspec

Link: https://gnugat.github.io/2016/08/17/mars-rover-driving-instruction.html


Trending Topics: