# luis-lop-nas/examen-sorpresa architecture

> Architecture diagram of the GitHub repository luis-lop-nas/examen-sorpresa, 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/luis-lop-nas/examen-sorpresa
- Repository: https://github.com/luis-lop-nas/examen-sorpresa

## Overview

This project is a small-scale Python application centered on geometric computations. Its primary purpose is to define and manipulate geometrical objects – namely, points (Punto) and rectangles (Rectangulo) – and to perform related calculations such as determining quadrants, computing vectors, distances, and rectangle attributes (base, height, area, perimeter).

##### Main Components
- User Interface / Input Module: Although this is a console-based application, include an "Input Handler" component that represents data entry (for example, the function crear_puntos() which collects coordinates from the user).
- Business Logic:
- Punto Module: Represent the Punto class along with its methods to compute quadrant, distance, and vector between points.
- Rectangulo Module: Represent the Rectangulo class with methods to compute rectangle features (calcular_base, calcular_altura, calcular_area, calcular_perimetro).
- Orchestrator / Controller:
- Output / Display:
- Output functionality is executed by functions like imprimir_puntos() and other consulting functions (consultar_cuadrante, consultar_vectores, consultar_distancias) to show computed results.

##### Relationships and Interactions
- A directional flow from the User Input component to the Main/Orchestrator.
- That Main.py and lanzador.py call the functions that create points and rectangles.
- Punto and Rectangulo modules to the business logic, indicating that:
- The Punto module is used to create and perform operations on points.
- The Rectangulo module uses points (the diagonal corners) to compute rectangle attributes.
- Flow from computation (by the business logic) back to the display/output functionality.

##### Architectural Patterns and Design Principles
- Although not formally separated into layers (MVC or similar), the project distinguishes between input collection, business logic, and output.
- Loose coupling by having distinct modules (punto.py for point-related methods and rectangulo.py for rectangle logic) that are then integrated in the driving files (main.py and lanzador.py).
- Stress separation of concerns for clarity in the system’s flow.

##### Technologies and Design Elements
- Python is the underlying programming language.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    subgraph "Input Layer"
        UI["Input Handler (crear_puntos)"]:::inputModule
    end

    %% Controller Layer
    subgraph "Controller"
        M1["main.py"]:::controller
        M2["lanzador.py"]:::controller
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        P["Punto Module (Punto class)"]:::datamodel
        R["Rectangulo Module (Rectangulo class)"]:::datamodel
    end

    %% Output Layer
    subgraph "Output Layer"
        O["Output Functions (imprimir_puntos,consultar_cuadrante,consultar_vectores,consultar_distancias)"]:::outputModule
    end

    %% Connections
    UI -->|"triggers"| M1
    UI -->|"triggers"| M2

    M1 -->|"calls"| P
    M1 -->|"calls"| R
    M2 -->|"calls"| P
    M2 -->|"calls"| R

    P -->|"returns results to"| O
    R -->|"returns results to"| O

    %% Click Events
    click M1 "https://github.com/luis-lop-nas/examen-sorpresa/blob/main/main.py"
    click M2 "https://github.com/luis-lop-nas/examen-sorpresa/blob/main/lanzador.py"
    click P "https://github.com/luis-lop-nas/examen-sorpresa/blob/main/punto.py"
    click R "https://github.com/luis-lop-nas/examen-sorpresa/blob/main/rectangulo.py"

    %% Styles
    classDef inputModule fill:#FFDD93,stroke:#333,stroke-width:1px;
    classDef controller fill:#87CEEB,stroke:#333,stroke-width:1px;
    classDef datamodel fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef outputModule fill:#FAD6A5,stroke:#333,stroke-width:1px;
```
