# fersar25/gestordeprestamos architecture

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

- Interactive diagram: https://gitdiagram.com/fersar25/gestordeprestamos
- Repository: https://github.com/fersar25/gestordeprestamos

## Overview

##### Main Components
- User Interface (GUI): Located in the src/gui directory, files like Main.java and Interfaz.java form the presentation layer.
- Controller (Controlador): Found in src/control/Controlador.java, this acts as the intermediary between the user interface and the system’s business logic.
- Business Logic (Model): Found in src/logic (e.g., Almacén.java, Alquiler.java, Estudiante.java, Persona.java, Responsable.java, Traje.java). This layer implements the core functionalities and models the data for the rental system.
- Persistence (Data Access): Found in src/persistence/ArchivoAlquiler.java and supported by the alquileres.csv file. This layer handles data storage and retrieval.

##### Relationships and Interactions
- The GUI layer (presentation) initiates user actions.
- These actions are passed to the Controller, which routes requests to the appropriate business logic components.
- The business logic layer processes data and, when necessary, interacts with the Persistence layer to read or write data.
- Data from persistence (the CSV file) is fed back through the business logic and then back to the interface for display.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Dividing the system into discrete layers (GUI, Control, Logic, Persistence) minimizes coupling.
- MVC Pattern: Although simple, the design closely matches MVC, with the GUI as the View, Controller as the intermediary handler, and the business logic encapsulating the Model.
- Layered Architecture: Each component focuses on its responsibility, making it easier to maintain and extend.

##### Relevant Technologies and Libraries
- Java forms the basis of the project.
- Standard libraries for file I/O are used in the persistence layer.
- There may be built-in or custom utilities in the logic layer for handling business-related operations (not explicitly shown, but implied).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "GUI (src/gui)"
        Main["Main.java"]:::presentation
        Interfaz["Interfaz.java"]:::presentation
    end

    subgraph "Controller (src/control)"
        Controlador["Controlador.java"]:::controller
    end

    subgraph "Business Logic (src/logic)"
        Almacen["Almacen.java"]:::logic
        Alquiler["Alquiler.java"]:::logic
        Estudiante["Estudiante.java"]:::logic
        Persona["Persona.java"]:::logic
        Responsable["Responsable.java"]:::logic
        Traje["Traje.java"]:::logic
    end

    subgraph "Persistence (src/persistence)"
        Archivo["ArchivoAlquiler.java"]:::persistence
        CSV["alquileres.csv"]:::persistenceDoc
    end

    %% Flow of user actions and data
    Interfaz -->|"triggers"| Controlador
    Controlador -->|"delegates"| Almacen
    Almacen -->|"invokes_data_layer"| Archivo
    Archivo -->|"returns_data"| Almacen
    Almacen -->|"sends_results"| Controlador
    Controlador -->|"updates_UI"| Interfaz

    %% Additional connection for persistence file storage
    Archivo -->|"handles_storage"| CSV

    %% Click Events
    click Main "https://github.com/fersar25/gestordeprestamos/tree/main/src/gui"
    click Interfaz "https://github.com/fersar25/gestordeprestamos/tree/main/src/gui"
    click Controlador "https://github.com/fersar25/gestordeprestamos/blob/main/src/control/Controlador.java"
    click Almacen "https://github.com/fersar25/gestordeprestamos/blob/main/src/logic/Almacen.java"
    click Alquiler "https://github.com/fersar25/gestordeprestamos/blob/main/src/logic/Alquiler.java"
    click Estudiante "https://github.com/fersar25/gestordeprestamos/blob/main/src/logic/Estudiante.java"
    click Persona "https://github.com/fersar25/gestordeprestamos/blob/main/src/logic/Persona.java"
    click Responsable "https://github.com/fersar25/gestordeprestamos/blob/main/src/logic/Responsable.java"
    click Traje "https://github.com/fersar25/gestordeprestamos/blob/main/src/logic/Traje.java"
    click Archivo "https://github.com/fersar25/gestordeprestamos/blob/main/src/persistence/ArchivoAlquiler.java"
    click CSV "https://github.com/fersar25/gestordeprestamos/blob/main/alquileres.csv"

    %% Styles
    classDef presentation fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef controller fill:#c8e6c9,stroke:#1b5e20,stroke-width:2px;
    classDef logic fill:#ffe0b2,stroke:#e65100,stroke-width:2px;
    classDef persistence fill:#fff59d,stroke:#f57f17,stroke-width:2px;
    classDef persistenceDoc fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
```
