# aztfirespell/metodosordenacion architecture

> Architecture diagram of the GitHub repository aztfirespell/metodosordenacion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aztfirespell/metodosordenacion
- Repository: https://github.com/aztfirespell/metodosordenacion

## Overview

##### Project Overview & Purpose
- The project is a performance benchmarking tool for four different sorting methods (Bubble, Shell, Insertion, QuickSort) implemented in C/C++.
- Additionally, the automation invoked by a batch file (“graficar.bat”) launches an Excel workbook (“grafica1.xlsm”) that contains a macro (with code found in “visual.txt”) to generate the graph.

##### And Label Main Components
- Core Sorting Module (sistema.cpp)
- Implements the logic to generate the random array.
- Contains the implementations for Bubble Sort, Shell Sort, Insertion Sort, and QuickSort.
- Measures and logs execution times.
- Output Data Module:
- Generates a file, likely “TiempoFinal.txt” (referenced in the README), that logs the performance results.
- Visualization Module:
- Consists of the Excel macro file (“grafica1.xlsm”) that generates a graph.
- Contains supporting Visual Basic code (provided in “visual.txt”) for automation.
- The process is triggered through the “graficar.bat” batch script, which runs the Excel file.

##### Relationships and Data Flow
- The flow starts with the execution of the main program (sistema.cpp), which sets off the following:
- Random data generation → processing by each sorting method → time measurement.
- After sorting, the performance results get written into “TiempoFinal.txt”.
- Once the results are logged, the program (or a subsequent process) executes “graficar.bat”.
- The batch file then opens “grafica1.xlsm”.
- Within “grafica1.xlsm”, a Visual Basic macro (from “visual.txt”) reads “TiempoFinal.txt” and generates the corresponding graphical output.
- From “sistema.cpp” to “TiempoFinal.txt”
- From “TiempoFinal.txt” to “graficar.bat” (or mark “graficar.bat” as the trigger to call Excel)
- From “graficar.bat” to “grafica1.xlsm”

##### Architectural Patterns & Design Principles
- Modularity – the design clearly separates computation (sorting logic in sistema.cpp) from visualization (Excel workbook and Visual Basic code).
- Loose Coupling – the performance measurement and output (data file generation) are decoupled from the visualization, which is triggered externally.
- Use of external automation – leveraging batch scripting and Excel’s macro capabilities acknowledges integration with third-party tools.
- Although not an MVC architecture, the separation of concerns (processing vs. displaying results) is an important design principle here.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Sorting and Benchmarking"
        A["Sorting & Benchmarking Engine (sistema.cpp)"]:::engine
    end

    subgraph "Output and Visualization"
        B["Performance Data File (TiempoFinal.txt)"]:::file
        C["Batch Launcher (graficar.bat)"]:::batch
        D["Excel Visualization Module (grafica1.xlsm)"]:::excel
        E["Visual Basic Code (visual.txt)"]:::vbc
    end

    A -->|"GeneratesPerformanceData"| B
    B -->|"TriggersBatch"| C
    C -->|"LaunchesExcel"| D
    D -->|"ExecutesMacroFrom"| E

    click A "https://github.com/aztfirespell/metodosordenacion/blob/main/sistema.cpp"
    click C "https://github.com/aztfirespell/metodosordenacion/blob/main/graficar.bat"
    click D "https://github.com/aztfirespell/metodosordenacion/blob/main/grafica1.xlsm"
    click E "https://github.com/aztfirespell/metodosordenacion/blob/main/visual.txt"

    classDef engine fill:#f4a261,stroke:#264653,stroke-width:2px;
    classDef file fill:#2a9d8f,stroke:#264653,stroke-width:2px;
    classDef batch fill:#e9c46a,stroke:#264653,stroke-width:2px;
    classDef excel fill:#e76f51,stroke:#264653,stroke-width:2px;
    classDef vbc fill:#8ab17d,stroke:#264653,stroke-width:2px;
```
