# onkyou39/kursovaya-2-kurs architecture

> Architecture diagram of the GitHub repository onkyou39/kursovaya-2-kurs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/onkyou39/kursovaya-2-kurs
- Repository: https://github.com/onkyou39/kursovaya-2-kurs

## Overview

##### Main Components
- Data Input Component – Responsible for reading the array of structures from the text file when the program starts.
- In-Memory Data Model – Represents the array of structures, including maintaining the “busy/free” flag and logical numbers.
- Operation Module – This component encapsulates all CRUD-style operations on the array:
– Creation of the array from the file.
– Updating an element’s fields.
– Querying (retrieving) an element by its logical number.
– Deleting an element (marking it free) and handling addition, including array “compression”.
– Getting counts (number of busy elements and number of rows).
- /Output Component – Handles printing the array on the screen.
- Data Output Component – Writes the busy elements back to the text file before the program terminates.
- Main Controller – The main routine (likely in Source.cpp) that ties the modules together; it sequences the reading, applying operations (possibly in an interactive or predetermined manner), output, and cleanup.

##### Relationships and Interactions
- The Main Controller initiates the Data Input Component to load the data.
- Once loaded, the In-Memory Data Model holds the array data.
- The Display/Output Component reads from the Data Model to show the current state of the array.
- Before termination, the Main Controller calls the Data Output Component to save changes back to the file.
- Optionally, a feedback loop from operations to the user (or console) can be visually represented if the application interacts with user inputs.

##### Architectural Patterns and Design Principles
- The separation between “data handling” (reading/writing files) and “data manipulation” (operations on the array) is key.
- The operations are performed on an in-memory data structure that is a central repository for all modifications.
- The data “compression” operation can be highlighted as a special procedure that deals with housekeeping and ensuring data consistency.

##### Relevant Technologies and Frameworks
- Visual Studio project files (Kursovaya 2 kurs.sln, .vcxproj, etc.) indicate a Windows-based C++ application.
- Standard C++ libraries are used for file I/O and array manipulation.
- Although no external frameworks are evident, the design can indicate “File I/O” and “Console Output” as self-contained modules.

- From the Data Model, show connections to the Operation Module, which encapsulates all operations (add, delete, modify, query, and compress).

## Diagram (Mermaid)

```mermaid
flowchart TD
    MC["Main Controller"]:::controller
    TF["test.txt"]:::fileComp
    DI["Data Input Component"]:::inputComp
    IM["In-Memory Data Model"]:::modelComp
    OM["Operation Module"]:::operationComp
    DO["Display/Output Component"]:::outputComp
    DOut["Data Output Component"]:::outputComp

    MC -->|"initiate"| DI
    MC -->|"orchestrates"| OM
    MC -->|"coordinatesSave"| DOut

    TF -->|"readsData"| DI
    DI -->|"loadsDataInto"| IM
    OM -->|"performsCRUD"| IM
    IM -->|"providesDataTo"| DO
    DOut -->|"writesDataTo"| TF

    %% Click Events
    click MC "https://github.com/onkyou39/kursovaya-2-kurs/blob/master/Source.cpp"
    click DI "https://github.com/onkyou39/kursovaya-2-kurs/blob/master/Source.cpp"
    click IM "https://github.com/onkyou39/kursovaya-2-kurs/blob/master/Source.cpp"
    click OM "https://github.com/onkyou39/kursovaya-2-kurs/blob/master/Source.cpp"
    click DO "https://github.com/onkyou39/kursovaya-2-kurs/blob/master/Source.cpp"
    click DOut "https://github.com/onkyou39/kursovaya-2-kurs/blob/master/Source.cpp"

    %% Styles
    classDef controller fill:#f9d56e,stroke:#333,stroke-width:2px,color:#000;
    classDef inputComp fill:#a0d2eb,stroke:#333,stroke-width:2px,color:#000;
    classDef modelComp fill:#c3f584,stroke:#333,stroke-width:2px,color:#000;
    classDef operationComp fill:#f7a8a8,stroke:#333,stroke-width:2px,color:#000;
    classDef outputComp fill:#d3a4f9,stroke:#333,stroke-width:2px,color:#000;
    classDef fileComp fill:#f2b3d0,stroke:#333,stroke-width:2px,color:#000;
```
