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

Loïc Faugeron:
Mars Rover, Locating refactoring
Sep 28, 2016 @ 15:57:31

Loïc Faugeron has continued his "Mars Rover" series with this latest article posted to his site. In this most recent tutorial he takes some time to refactor some of the current "locating" code and make it fully functional.

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 the second one about driving it. We're now developing the last one, requesting its location: Mars rover will be requested to give its current location (x and y coordinates and the orientation). In this article we're going to create the locating logic.

He starts with the phpspec tests for the Location handling and edits the generated test to integrate the "coordinates" and "orientation" checks. When this test runs phpspec generates the "Location" class with basic logic. This is updated as well with real functionality and the "LandRover" class is then refactored to make use of all of this new functionality. The final code for the "LandRover" class is also included for reference, post-refactor.

tagged: mars rover tutorial series locating coordinates orientation phpspec

Link: https://gnugat.github.io/2016/09/28/mars-rover-locating-refactoring.html

Loïc Faugeron:
Mars Rover, Landing coordinates
Jul 07, 2016 @ 16:47:20

Loïc Faugeron has continued his "Mars Rover" series of posts with this latest tutorial covering the functionality for the landing coordinates.

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

Previously we've created a navigation package, and in it a LandRover class that validates input parameters for our first use case. [...] In this article we're going to refactor LandRover.

He starts off with the justification of why the LandRover class needs to change and what kinds of new classes need to be made. He starts with the phpspec tests and builds out the Coordinates and Orientation classes (with some basic functionality) to make the movement and direction of the rover more flexible and the meet the test requirements.

tagged: mars rover tutorial series landing coordinates orientation phpspec

Link: https://gnugat.github.io/2016/07/06/mars-rover-landing-coordinates.html


Trending Topics: