How dsiu/advent-of-code works
Main components
a. Year-based Solution Directories – The “src” directory is organized into subdirectories by year (e.g., src/2018, src/2019, …, src/2023). Within each year’s folder, individual “Day” subdirectories contain solution modules, input data files, and test files.
b. Core/Utility Libraries – In addition to the year/day solutions, shared modules (like Array2D, Coordinate, ChineseRemainder, Dijkstra, PriorityQueue, etc.) reside directly under “src”. These provide reusable algorithms and data structures commonly needed to solve the puzzles.
c. Test Suites – The “__tests__” folder includes tests for many of the core utilities (and potentially some day solutions). Some tests are written in both JavaScript (.mjs) and ReScript (.res) formats.
d. Interop & Integration – The “interop” directory and related files (such as Jest interop files) indicate interoperability layers between testing or between ReScript and JavaScript runtimes.
e. Build & Configuration – There are configuration files (.editorconfig, .vscode, package.json, rescript.json, GitHub Actions workflows, and more) that control the development, build processes, and continuous integration pipelines.
Relationships/Interactions
c. The Interop components serve as bridges to connect testing frameworks (like Jest) to both ReScript (.res) and JavaScript (.mjs) code; indicate these with arrowed connections towards tests or main run files.
d. Configuration and CI components (GitHub workflows, package.json, and configuration files) underpin the entire system and can be represented as external components that “control” or “trigger” execution flows in the solution and test modules.
Architectural Patterns/Design Principles
a. Modularity – The clear separation into year-based folders and a distinct core library folder shows a modular design where each “day” is independent yet leverages common utilities.
b. Layered Architecture – Recognize a layered system where at the bottom you have low-level utilities (data structures, algorithms), then the application layer (each day’s puzzle solution), and finally the testing/integration layer.
c. Separation of concerns – The division between solution code and test code, along with integration/interop files, exemplifies best practices.
Relevant Technologies
b. Node.js environment – The presence of package.json and GitHub workflows implies a Node-based execution environment.
c. Testing frameworks (likely Jest) – The “interop/Jest2.mjs” and related files indicate that testing relies on Jest’s interop between languages.