📜 ⬆️ ⬇️

Mars Rover, Introduction



Welcome to the Mars Rover series, where we will use the following practices:


In this introductory article, we simply denote the specifications of our rover.
')
Note This example is adapted for the needs of a series of articles version of the exercise presented at the Dallas Hack Club , which now, unfortunately, is.


But first, let's take a quick look at the terms mentioned above.

Monolithic Repositories - MonoRepo (Monolithic Repositories)


A monolithic repository is a single versioned repository containing many packages connected to each other, having the opportunity to be divided into their own repositories, but for reasons of convenience they are folded in one place.

This approach gives us the following benefits:


However, it also brings the following disadvantages:


It makes sense to make such repositories for projects that will be packaged / released together (although separate repositories do not exclude such a possibility)

Note Here are some links for additional acquaintance with monolithic repositories:


Command / Query Responsibility Segregation - CQRS (Segregation of responsibility for reading and writing)


CQRS is about separating the logic of "writing" and "reading", and it can be applied at many levels, for example:


It is important to note that CQRS can also be partially applied in a project: use it only when it really makes sense.

Note Here are some links about CQRS :


Event Sourcing - ES (Events as source)


With ES, every meaningful action is recorded as an “event.” Tracking such events provides the following benefits:


As with CQRS , it is important to note that ES can also be applied _particle_ in a project: use it only when necessary.

ES is often associated with CQRS , but they can be used separately.

Note Here are some links about ES :


Test Driven Development - TDD (Development through testing)


TDD can be reduced to three steps:

  1. create test
  2. write enough code to pass the test (quick and dirty, or just "make it work")
  3. code refactoring (creating clean, “properly working”)

Writing tests to code makes us think about how future code would be used. It’s like writing specifications, but with three goals at once: design, documentation development and automated regression testing.

This approach easily allows you to have high code coverage (although, strictly speaking, you still need to check all possible code paths, not only successful ones).

Note Here are some links about TDD :


Specs


The purpose of this series is to create software for the rover, according to the following specifications:

The rover will first have to land in a predetermined position. The position consists of the coordinates ( X and Y , which are integers) and orientation (the string value is north , east , west or south ).

After all this, he will be able to drive using instructions such as move_forward (keeping orientation, but moving along the x or y axis) or turn_left / turn_right (keeping the same coordinates but changing orientation).

From time to time, he will report the current location (again, x and y coordinates and orientation).

For example, a rover may have landed on 23 , 42 , north and then get instructions to move forward twice, then to the left, and then forward again. When the coordinates are requested, he will report 22 , 44 , west .

Decompose the task


From the above specifications, you can identify at least three options for use:

  1. Landing rover on mars
  2. Driving
  3. Location request

What's next


In the next article we will create a project and its first package: navigation .

Note We will use:



Next part: Rover, Initialization

Source: https://habr.com/ru/post/314536/


All Articles