How impulsado/prac-pro2 works
Main Components
• Domain Model:
◦ Classes such as City (Ciutat), Collection of Cities (Cjt_ciutats), and Collection of Products (Cjt_productes) are central.
◦ Other domain classes include the Ship (Vaixell) and Journey (Viatge).
◦ The “Llanxa” module is fundamental as it implements the algorithm for determining the optimal path.
• Input/Output Module:
◦ The project reads data from sample input files (located in the samples folder) and/or standard input.
◦ The output component returns the result of the simulation (for example, the computed best route, exchanged products, etc.).
• Control/Processing Flow:
◦ The main driver (program.cc) is responsible for orchestrating the sequence: reading inputs, setting up the cities tree, invoking the trade simulation, and calling the Llanxa algorithm.
◦ This overall algorithm determines the trade execution among cities and the ship’s journey.
Out Relationships and Interactions
• That the main program (controller) initializes and interacts with the core domain model.
• That "Cjt_ciutats" aggregates multiple "Ciutat" objects, each holding a "Cjt_productes" as its inventory.
• How the Llanxa module computes the “best route” (Viatge) for the ship based on criteria such as quantity and distance.
• Data flow from input (samples and command line) -> domain processing -> output (results/log).
Architectural Patterns / Design Principles
• The system uses clear modular separation:
◦ Domain Layer: Contains all the business logic and entities.
◦ Simulation/Processing Layer: Coordinates interactions among domain entities and implements the trading/route calculation algorithms.
◦ Interface Layer: Handles I/O (console-based or through sample files).
• Modularity and separation of concerns – each major component has a distinct role (e.g., trading mechanism vs. route calculation).
Technologies and Tools
• C++ as the implementation language.
• The Makefile for build automation.
• Git for version control.
Final Advice
• Be as detailed as possible: list every major module and its role, including supporting files like the Makefile or Doxygen documentation.
• Avoid over-cluttering, but remember that capturing the modular design precisely—even if it means having multiple sub-components—is preferred.
• Starting with a high-level view (domain vs. controller vs. I/O) and then drilling down to show interactions like how Llanxa interacts with Vaixell and the Viatge.