This project demonstrates a DDD-inspired, modular, and testable architecture using Kotlin and Maven.
The application allows controlling robotic mowers on a rectangular plateau, processing movement instructions and reporting their final positions.
- model-layer: Domain model (value objects, business logic)
- service-layer: Application logic (MowerEngine, validation, handlers)
- adapter-layer: Parsers/adapters for input/output (used by web and CLI)
- web-layer: REST API (Spring Boot, controllers, OpenAPI/Swagger)
- cli-layer: Command-line interface for interactive use
- docs/: PlantUML diagrams for each layer
Note: Persistence is not supported, as it was not required in the problem statement.
- The plateau is defined by its top-right coordinates (bottom-left is always 0,0).
- Each mower is initialized with a position (x, y, direction) and a sequence of actions (L, R, M).
- Mowers are processed sequentially: the next mower starts only after the previous one finishes.
- The system prevents mowers from leaving the plateau or overlapping.
- Input and output formats match the problem statement (see below).
- Only one plateau is supported (as per MVP scope).
- Input is received as a multiline string (via HTTP POST or CLI).
- Directions are N, E, S, W. Actions are L (left), R (right), M (move forward).
- If a mower tries to move to an invalid or occupied position, it stays in place.
- The domain and service layers are pure Kotlin, with no Spring dependencies.
- Parsers and mappers are placed in the adapter-layer for reuse across interfaces.
- Some model classes are visible in the web-layer because they are simple. More complex models are encapsulated in the service layer (ex: Plateau).
- The previous one is to apply KISS. If the system grows it would be a good idea to encapsulate the model and create whole DTO objects to communicate with the service-layer.
- Build the project:
mvn clean install
- Run the web application:
cd web-layer mvn spring-boot:run - Access Swagger UI:
NOTE: The CLI application needs JDK 17 or higher to run.
- Build and run the CLI application:
sh ./cli-layer/run-cli.sh # or, from inside cli-layer sh ./run-cli.sh- You will be prompted to enter the plateau size, mower positions, and actions interactively.
5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM
Expected output:
1 3 N
5 1 E
- Run all tests:
mvn test - Includes unit tests (domain, service, adapter) and integration tests (controller, E2E)
- See
docs/for PlantUML diagrams of each layer.
MIT