04. Solution Strategy¶
Architectural Style — Hexagonal (Ports & Adapters)¶
The domain logic is completely isolated from I/O. The CLI is just one possible adapter; the same domain could be driven by an HTTP API or a test suite without any changes to the core.
┌─────────────────────────────────────────────────────┐
│ CLI Adapter (stdin/stdout) │
│ InputParser OutputFormatter │
└──────────────────────┬──────────────────────────────┘
│
┌──────────────────────▼──────────────────────────────┐
│ Application Layer │
│ MissionController │
└──────────────────────┬──────────────────────────────┘
│
┌──────────────────────▼──────────────────────────────┐
│ Domain Layer │
│ Plateau Rover Heading Command (protocol) │
└─────────────────────────────────────────────────────┘
Key Design Decisions¶
Decision |
Choice |
Rationale |
|---|---|---|
Domain isolation |
Hexagonal architecture |
Domain has zero I/O dependencies; fully unit-testable |
Command processing |
Command pattern — each instruction is a callable that transforms |
Adding new commands requires no changes to existing code (open/closed principle) |
Heading rotation |
|
Rotation logic lives in one place; no conditionals scattered across the codebase |
Boundary enforcement |
|
Domain rule stays in the domain; adapter never needs to know about grid limits |
Input parsing |
Dedicated |
Keeps raw string handling out of the domain |
Technology Choices¶
Concern |
Choice |
|---|---|
Language |
Python 3.12 |
Testing |
|
Linting / formatting |
|
Diagram format |
PlantUML (C4 model) |