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

Loïc Faugeron:
Mars Rover, Locating moving
Oct 13, 2016 @ 14:44:59

Loïc Faugeron has posted the latest in his "Mars Rover" tutorial series to his site today. In this new post he migrates some previously created objects over into their own package to help with reporting back the rover's location.

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. In this article we're going to move geolocation value objects (Location, Coordinates and Orientation) into their new package (geolocation).

He then moves over the files relating to these objects into the "Geolocation" directory and fixed the namespace to reflect the update. Tests are all still passing so he moves over to the "navigation" package and fixes a few places in the tests where these objects were mentioned (doing the same for the "orientation" handling). This finishes out the series with a complete set of classes and objects reflecting the requirements. He summarises the work that was done, how the resulting code is structured and the major role that the phpspec testing played in the whole process.

tagged: mars rover tutorial series location moving event eventsourcing commandbus phpspec

Link: https://gnugat.github.io/2016/10/12/mars-rover-locating-moving.html

Loïc Faugeron:
Mars Rover, Locating geolocation
Oct 05, 2016 @ 14:04:37

Loïc Faugeron is back with the next part of his "Mars Rover" series (you can find all of the articles so far here with his latest post covering the Locating class' geolocation functionality.

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. [...] In this article we're going to create a new package for the geolocation value objects (Location, Coordinates and Orientation).

He starts off by creating the geolocation package and its matching composer.json file. He then creates the phpspec configuration for the package and commits this initial version. He pulls this new package into the larger current codebase and makes an update to the overall phpspec configuration to run its tests. With that in place he updates two related packages, location and navigation, to include the new library before integration (coming in the next part of the series).

tagged: mars rover tutorial series location geolocation package

Link: https://gnugat.github.io/2016/10/05/mars-rover-locating-geolocation.html

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, Locating handler
Sep 21, 2016 @ 15:39:30

Loïc Faugeron continues his "Mars Rover" series of posts today with the latest in the series covering the "Locating" handler, the functionality responsible for handling requests for the rover's location.

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

He makes use of the command bus pattern to create the handling for the module, doing validation in the Command object and a Bus to handle the command and perform its task. He starts, as usual, with the phpspec tests defining a class that can use a "find latest location" type instance and a "find" method to abstract out the location repsonse.

tagged: mars rover tutorial series location handler phpspec

Link: https://gnugat.github.io/2016/09/21/mars-rover-locating-handler.html

Loïc Faugeron:
Mars Rover, Locating package
Sep 14, 2016 @ 14:51:52

Loïc Faugeron continues his long running series covering the creation of a "Mars Rover" package to help teach programming fundamentals. In this latest tutorial he starts on the last use case in the project: requesting the location of 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 the second one about driving it. We're now going to start developing the last one, requesting its location:

Mars rover will be requested to give their current location (x and y coordinates and the orientation).

In this article we're going to create a new package for the location logic.

He starts by giving a justification as to why a new package is being created just for the location requests (when the navigation package could just be asked for that information). With that explained, he starts in on creating the new package and its tests with phpspec. He then adds this package into the current project's Composer configuration and updates the phpspec configuration to tell it about the newly creates code.

tagged: mars rover tutorial series location package phpspec

Link: https://gnugat.github.io/2016/09/14/mars-rover-locating-package.html

Loïc Faugeron:
Mars Rover, Driving event
Sep 07, 2016 @ 15:34:18

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.

tagged: mars rover tutorial series driving event eventsourcing commandbus phpspec

Link: https://gnugat.github.io/2016/09/07/mars-rover-driving-event.html

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

Loïc Faugeron:
Mars Rover, Driving
Aug 10, 2016 @ 16:24:36

Loïc Faugeron continues his series of "Mars Rover" tutorial posts with the latest covering the driving of 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), Test Driven Development (TDD)

We just finished developing the first use case, so we can now get cracking on the second one, driving the rover.

As is tradition in this series, he starts with the phpspec testing, defining the DriverRover spec requiring driving instructions to be provided. He generates the code for it and fills in the brief functional details handling the instruction property. He also adds in some validations as far as what instructions it can be given and re-runs the tests to ensure they all pass.

tagged: mars rover tutorial series driving usecase phpspec

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

Loïc Faugeron:
Mars Rover, Event Sourcing code
Aug 03, 2016 @ 15:39:52

Loïc Faugeron has continued his series developing the code for a "Mars Lander" coding exercise with this latest post sharing the actual code for the event sourcing functionality started in the previous tutorial.

In this series we're building 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). Up until now, we've implemented the first use case, "Landing a rover on Mars".

We've also created an event-sourcing package with the following interfaces: Event, AnEventHappened and EventStore. In this article, we're going to implement them.

He then starts in using phpspec to generate the Event class for him and gives it a basic structure. He fleshes this out with a bit of functionality (to make the tests pass) and moves on to the "AnEventHappened" class. He generates the class in the same way as before and adds a "just now" method to return the event that "just happened". The last class, the "EventStore" could do different things depending on the storage method, so he's delaying that for now and will implement it later.

tagged: mars rover tutorial series event sourcing phpspec

Link: https://gnugat.github.io/2016/08/03/mars-rover-event-sourcing-code.html

Loïc Faugeron:
Mars Rover, Event Sourcing package
Jul 27, 2016 @ 16:51:05

Loïc Faugeron has continued his "Mars Rover" series in his latest post today. This series, based on a set of specifications from a development challenge. In this latest post he continues looking at event sourcing and creates a package to handle the eventing to make it more flexible and robust.

In this series we're building 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) Test Driven Development (TDD).

Up until now, we've implemented the first use case, "Landing a rover on Mars" [and] in the last article, we wrote some Event Sourcing code. [...] In this article, we're going to extract them from the navigation package and put them in their own event-sourcing package.

He starts by creating the package itself as a Composer package including the composer.json configuration and a few other files to have phpspec work correctly. He then adds the event-sourcing package to the main project and starts in on using phpspec to generate its basic files. He then updates the main Lander class to use this new package for events. There's no code in the eventing classes yet, but stay tuned for the next tutorial in the series that will update them and get it all working together.

tagged: mars rover tutorial series landing event sourcing package phpspec

Link: https://gnugat.github.io/2016/07/27/mars-rover-event-sourcing-package.html


Trending Topics: