Loïc Faugeron: Mars Rover, Landing orientation

Loïc Faugeron is back again with the next part of his "Mars Rover" series of tutorials. In this new article he refactors the current code even more to make it more flexible in the long run.

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.

We’ve also started to refactor it by extracting coordinates in their own class. In this article we’re going to further refactor LandRover

He found that the coordinates could become floats (or have additional values) and that the orientation could become an angular degree/be vertical. To help this situation, he pulls this logic out into an Orientation class. True to the TDD methods, he starts with the phpspec test and generates the skeleton class based on them. He makes some simple edits to make the tests pass and updates the main LandRover class to use the new Orientation class for these positions.


Schreibe einen Kommentar