In this latest post in the series Loïc Faugeron continues his "Mars Rover" tutorials, this time with a focus on creating the logic that will "drive" the rover around.
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 create the actual driving logic, using Event Sourcing.
He follows the "Command Bus" design pattern and creates the command structure for the
DriveRoverHandler to handle the logic related to the
DriveRover instance. He starts with the spec (the test) and updates the generated class with the logic in the
handle method to record an event happening on the
DriveRover instance. He make a few more changes to the functionality for the spec and class to make the tests go green.