Loïc Faugeron has posted the latest part of his "Mars Rover" series documenting the creation of a system to control a rover following the ideas of Monolithic Repositories, Command / Query Responsibility Segregation, Event Sourcing and Test Driven Development (using phpspec). In his previous posts he set up the project and created the package for navigation. in this latest post he gets into the navigation package.
Previously we've created a navigation package, we can now start developing the first use case:Mars Rovers need first to be landed at a given position. A position is composed of coordinates (x and y, which are both integers) and an orientation (a string being one of north, east, west or south).
He starts off with using the Command Bus pattern to create a command, a handler and a bus that acts on the commands given. True to TDD he starts with the tests and fills in the code to make it all work. This generates the skeleton class for the test which is then filled in with functionality. Running the tests again then has them all passing once a few more changes are made to the internal handling (besides just the basics).