# ayesa14/proyecto-programacion architecture

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

- Interactive diagram: https://gitdiagram.com/ayesa14/proyecto-programacion
- Repository: https://github.com/ayesa14/proyecto-programacion

## Overview

##### Main Components
- Controller Layer: Contains multiple controllers organized under “src/controller”. Note the clear separation between administration controllers (like CambioPass, MenuAdministracion) and order system controllers (under “src/controller/sistema_pedidos” with subdivisions for new orders, adding items, and finalizing orders).
- Model Layer: All business and data-related logic resides in “src/model”. This includes database connectivity (as seen in DatabaseConnectionService.java) and model classes for different functionalities (administration, orders, etc.).
- View Layer: The user interfaces are defined in “src/view” and are built with Swing. They have corresponding packages mirroring the controller structure.
- Database Component: The Oracle Database is external and is integrated via the “ojdbc6.jar” library (found in the "lib" directory) along with database configuration properties in “src/model/database_config.properties”.

##### Relationships and Interactions
- MVC Data Flow:
- The User interacts with the View (Swing UI) → the View passes the request to the Controller.
- The Controller processes the request, interacts with the Model to retrieve or update business data and then instructs the View to update accordingly.
- The Model communicates with the Oracle Database (using ojdbc6.jar and configuration details provided) to fetch or persist data.
- Specific Paths: Distinguish the administration flow versus the typical order system flow. For example, administration actions (e.g., changing passwords, managing products/mesas, viewing order history) are handled by a distinct set of controllers, models, and views.
- External Data Flow: Highlight the connections between the Model classes (like DatabaseConnectionService.java) and the Oracle Database, indicating the reliance on the provided scripts for table creation and data insertion.

##### Architectural Patterns & Design Principles
- The Model handles data and business rules.
- The View deals with the graphical representation (Swing components).
- The Controller serves as the mediator between Model and View.
- Modularization: Emphasize the sub-categorization (e.g., ‘administracion’ and ‘sistema_pedidos’) which improves maintainability and separation of functionality.
- Dependency Management: Include the external dependency to Oracle (via ojdbc6.jar) and configuration files like “database_config.properties”.

- Labels: Clearly mark each component with names (e.g., “InicioController”, “GestionProductosModel”, “AddComandaView”) where necessary to reflect their category or function.
- External Dependencies: Mark the Oracle Database and include a note indicating that Oracle’s ojdbc6.jar library enables connectivity.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Interaction
    U["User"]:::auxiliary

    %% View Layer
    subgraph "View Layer"
        V["Swing UI"]:::view
        AV["Administracion Views"]:::view
        SPV["Sistema Pedidos Views"]:::view
    end

    %% Controller Layer
    subgraph "Controller Layer"
        AC["Administracion Controllers"]:::controller
        GC["Gestion Controllers"]:::controller
        HPC["Historial Pedidos Controllers"]:::controller
        OSC["Order System Controllers"]:::controller
    end

    %% Model Layer
    subgraph "Model Layer"
        BM["Business Models"]:::model
        DCS["Database Connection Service"]:::model
        DCP["Database Config"]:::model
    end

    %% Database Component
    subgraph "Database"
        DB["Oracle DB 11g XE"]:::database
    end

    %% External Dependencies
    subgraph "External Dependencies"
        OJ["ojdbc6.jar"]:::auxiliary
    end

    %% Auxiliary Elements
    subgraph "Auxiliary Elements"
        AUX["ER Diagram & Screenshots"]:::auxiliary
    end

    %% Flow Connections
    U -->|"interacts"| V
    V -->|"triggers"| AC
    V -->|"triggers"| OSC
    V -->|"uses"| AV
    V -->|"uses"| SPV

    AC -->|"handles"| BM
    GC -->|"handles"| BM
    HPC -->|"handles"| BM
    OSC -->|"handles"| BM

    BM -->|"utilizes"| DCS
    DCS <-->|"queries/updates"| DB

    %% Feedback flow (responses)
    BM -->|"returns result"| AC
    BM -->|"returns result"| OSC
    AC -->|"updates"| V
    OSC -->|"updates"| V

    %% Dependency from Model Config to External Library
    DCP -->|"configures"| OJ

    %% Auxiliary reference to Database (ER Diagram)
    AUX ---|"details"| DB

    %% Click Events
    click AC "https://github.com/ayesa14/proyecto-programacion/tree/master/src/controller/administracion"
    click GC "https://github.com/ayesa14/proyecto-programacion/tree/master/src/controller/administracion/gestion"
    click HPC "https://github.com/ayesa14/proyecto-programacion/tree/master/src/controller/administracion/historial_pedidos"
    click OSC "https://github.com/ayesa14/proyecto-programacion/tree/master/src/controller/sistema_pedidos"
    click BM "https://github.com/ayesa14/proyecto-programacion/tree/master/src/model"
    click DCP "https://github.com/ayesa14/proyecto-programacion/blob/master/src/model/database_config.properties"
    click OJ "https://github.com/ayesa14/proyecto-programacion/blob/master/lib/ojdbc6.jar"
    click V "https://github.com/ayesa14/proyecto-programacion/tree/master/src/view"
    click AV "https://github.com/ayesa14/proyecto-programacion/tree/master/src/view/administracion"
    click SPV "https://github.com/ayesa14/proyecto-programacion/tree/master/src/view/sistema_pedidos"
    click AUX "https://github.com/ayesa14/proyecto-programacion/tree/master/images"

    %% Styles
    classDef controller fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef model fill:#fefbd8,stroke:#333,stroke-width:2px;
    classDef view fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef database fill:#d1e7dd,stroke:#333,stroke-width:2px;
    classDef auxiliary fill:#e0bbff,stroke:#333,stroke-width:2px;
```
