# andres1125/tarea-4-programacion architecture

> Architecture diagram of the GitHub repository andres1125/tarea-4-programacion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andres1125/tarea-4-programacion
- Repository: https://github.com/andres1125/tarea-4-programacion

## Overview

1. **Repo purpose and runtime**
   - This is a small, single-process Python application for managing **clients, services, and reservations**.
   - There is no evidence of a web server, database, or external API integration. The system appears to run from `main.py` as a console/command-line style orchestration layer.

2. **High-level structure**
   - The codebase is organized into five domain modules plus an entrypoint:
     - `cliente.py` for customer data
     - `servicio.py` for the base service abstraction
     - `servicios_especificos.py` for concrete service types
     - `reserva.py` for reservation lifecycle
     - `excepciones.py` for domain-specific errors and logging
     - `main.py` for execution and manual flow testing
   - `logs.txt` is the persistent error log output used by the exception layer.

3. **Client management boundary**
   - `cliente.py` encapsulates customer identity and contact information.
   - The readme indicates validation of name, email, phone, and ID, plus update operations.
   - This module is a domain boundary for all user/customer input before it can be used in reservations.

4. **Service abstraction layer**
   - `servicio.py` defines the abstract base model for all services.
   - It provides shared validation and availability checks, and acts as the polymorphic contract for concrete services.
   - This is the main inheritance root in the system.

5. **Concrete service types**
   - `servicios_especificos.py` contains specialized service classes:
     - `ReservaSala`
     - `AlquilerEquipo`
     - `Asesoria`
   - These inherit from `Servicio` and override behavior such as cost calculation and description, so service-specific rules are centralized here rather than in reservation logic.

6. **Reservation workflow**
   - `reserva.py` coordinates the relationship between a `Cliente` and a `Servicio`, plus the reservation quantity or duration parameter shown in the README examples.
   - It handles reservation confirmation, cancellation, availability validation, and state control.
   - This is the main business-process module that consumes the client and service objects.

7. **Exception and logging subsystem**
   - `excepciones.py` centralizes custom error types:
     - `SoftwareFJError`
     - `ClienteError`
     - `ReservaError`
     - `DisponibilidadError`
   - The module also writes errors to `logs.txt`, so exception handling is not just control flow; it is also a persistence boundary for audit/debug data.

8. **Application orchestration**
   - `main.py` is the top-level composition point.
   - It creates example clients, instantiates services, builds reservations, confirms/cancels them, and intentionally exercises failure paths.
   - In an architecture diagram, this is the entrypoint that wires domain objects together but does not appear to own business rules itself.

9. **Primary data flow**
   - The typical flow is: create/validate `Cliente` → instantiate a concrete `Servicio` → create `Reserva` linking both → confirm or cancel the reservation.
   - Availability and validation checks occur along the way, and if any rule fails, the error is routed through the custom exception layer and logged.

10. **Dependency direction**
   - `servicios_especificos.py` depends on `servicio.py`.
   - `reserva.py` depends on client and service objects, and likely on exceptions for rule enforcement.
   - `main.py` depends on all domain modules to assemble and exercise the system.
   - `excepciones.py` is a cross-cutting dependency used by the other modules for standardized error handling.

11. **Important architectural style**
   - The repository uses **object-oriented domain modeling** rather than layered infrastructure or framework-driven design.
   - Core OO concepts are explicit: encapsulation in `cliente.py`, abstraction in `servicio.py`, inheritance/polymorphism in `servicios_especificos.py`, and stateful workflow in `reserva.py`.

12. **What is not present**
   - There is no sign of persistence beyond `logs.txt`, no ORM, no database schema, no network layer, and no UI framework.
   - The architecture is therefore a self-contained business rules engine / academic domain model, with file-based logging as the only visible I/O side effect.

13. **How to draw it**
   - A clear diagram should show `main.py` at the top, invoking the domain modules.
   - Place `cliente.py`, `servicio.py` + `servicios_especificos.py`, and `reserva.py` as the core business model layer.
   - Put `excepciones.py` as a shared cross-cutting concern pointing to `logs.txt`.
   - Show `reserva.py` consuming both client and service objects, with services inheriting from the abstract base class.

14. **Architectural summary**
   - This repository is best described as a modular Python OOP application where the main business entities are client, service, and reservation.
   - The system is designed around validation, service polymorphism, reservation state transitions, and centralized error logging rather than around external infrastructure.

Main entry points: [`main.py`](https://github.com/andres1125/tarea-4-programacion/blob/main/main.py) (main.py), [`reserva.py`](https://github.com/andres1125/tarea-4-programacion/blob/main/reserva.py) (Reserva), [`excepciones.py`](https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py) (excepciones.py), [`servicio.py`](https://github.com/andres1125/tarea-4-programacion/blob/main/servicio.py) (Servicio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_entry["Entrypoint"]
  node_main["main.py<br/>entrypoint<br/>[main.py]"]
end

subgraph group_group_domain["Domain model"]
  node_cliente["Cliente<br/>customer model<br/>[cliente.py]"]
  node_servicio["Servicio<br/>abstract service<br/>[servicio.py]"]
  node_reservasala["ReservaSala<br/>service subtype"]
  node_alquilerequipo["AlquilerEquipo<br/>service subtype"]
  node_asesoria["Asesoria<br/>service subtype"]
  node_reserva["Reserva<br/>workflow<br/>[reserva.py]"]
end

subgraph group_group_crosscut["Cross-cutting"]
  node_excepciones["excepciones.py<br/>error module<br/>[excepciones.py]"]
  node_softwarefjerror(("SoftwareFJError<br/>base error<br/>[excepciones.py]"))
  node_clienteerror(("ClienteError<br/>validation error<br/>[excepciones.py]"))
  node_reservaerror(("ReservaError<br/>workflow error<br/>[excepciones.py]"))
  node_disponibilidaderror(("DisponibilidadError<br/>availability error<br/>[excepciones.py]"))
  node_logs["logs.txt<br/>error log<br/>[logs.txt]"]
end

node_main -->|"creates"| node_cliente
node_main -->|"uses"| node_servicio
node_main -->|"instantiates"| node_reservasala
node_main -->|"instantiates"| node_alquilerequipo
node_main -->|"instantiates"| node_asesoria
node_main -->|"drives"| node_reserva
node_main -->|"handles"| node_excepciones
node_reservasala -->|"inherits"| node_servicio
node_alquilerequipo -->|"inherits"| node_servicio
node_asesoria -->|"inherits"| node_servicio
node_reserva -->|"links"| node_cliente
node_reserva -->|"links"| node_servicio
node_reserva -->|"raises"| node_clienteerror
node_reserva -->|"raises"| node_reservaerror
node_reserva -->|"raises"| node_disponibilidaderror
node_cliente -->|"raises"| node_clienteerror
node_servicio -->|"raises"| node_disponibilidaderror
node_excepciones -->|"defines"| node_softwarefjerror
node_excepciones -->|"defines"| node_clienteerror
node_excepciones -->|"defines"| node_reservaerror
node_excepciones -->|"defines"| node_disponibilidaderror
node_excepciones -->|"writes"| node_logs

click node_main "https://github.com/andres1125/tarea-4-programacion/blob/main/main.py"
click node_cliente "https://github.com/andres1125/tarea-4-programacion/blob/main/cliente.py"
click node_servicio "https://github.com/andres1125/tarea-4-programacion/blob/main/servicio.py"
click node_reservasala "https://github.com/andres1125/tarea-4-programacion/blob/main/servicios_especificos.py"
click node_alquilerequipo "https://github.com/andres1125/tarea-4-programacion/blob/main/servicios_especificos.py"
click node_asesoria "https://github.com/andres1125/tarea-4-programacion/blob/main/servicios_especificos.py"
click node_reserva "https://github.com/andres1125/tarea-4-programacion/blob/main/reserva.py"
click node_excepciones "https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py"
click node_softwarefjerror "https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py"
click node_clienteerror "https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py"
click node_reservaerror "https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py"
click node_disponibilidaderror "https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py"
click node_logs "https://github.com/andres1125/tarea-4-programacion/blob/main/logs.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main toneBlue
class node_cliente,node_servicio,node_reservasala,node_alquilerequipo,node_asesoria,node_reserva toneAmber
class node_excepciones,node_softwarefjerror,node_clienteerror,node_reservaerror,node_disponibilidaderror,node_logs toneMint
```

## Components

### Entrypoint

Application composition and execution

- [main.py](https://github.com/andres1125/tarea-4-programacion/blob/main/main.py): entrypoint · Top-level console orchestration and manual flow runner · `main.py`

### Domain model

Core business entities and reservation rules

- [Cliente](https://github.com/andres1125/tarea-4-programacion/blob/main/cliente.py): customer model · Customer identity, contact data, and validation · `cliente.py`
- [Servicio](https://github.com/andres1125/tarea-4-programacion/blob/main/servicio.py): abstract service · Base contract for shared service behavior · `servicio.py`
- [ReservaSala](https://github.com/andres1125/tarea-4-programacion/blob/main/servicios_especificos.py): service subtype · Room reservation implementation · `servicios_especificos.py`
- [AlquilerEquipo](https://github.com/andres1125/tarea-4-programacion/blob/main/servicios_especificos.py): service subtype · Equipment rental implementation · `servicios_especificos.py`
- [Asesoria](https://github.com/andres1125/tarea-4-programacion/blob/main/servicios_especificos.py): service subtype · Consulting implementation · `servicios_especificos.py`
- [Reserva](https://github.com/andres1125/tarea-4-programacion/blob/main/reserva.py): workflow · Reservation lifecycle, confirmation, cancellation, and availability checks · `reserva.py`

### Cross-cutting

Shared errors and file logging

- [excepciones.py](https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py): error module · Custom domain errors and logging setup · `excepciones.py`
- [SoftwareFJError](https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py): base error · Shared base exception for domain failures · `excepciones.py`
- [ClienteError](https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py): validation error · Client data rule violations · `excepciones.py`
- [ReservaError](https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py): workflow error · Reservation state and rule violations · `excepciones.py`
- [DisponibilidadError](https://github.com/andres1125/tarea-4-programacion/blob/main/excepciones.py): availability error · Service availability rule violations · `excepciones.py`
- [logs.txt](https://github.com/andres1125/tarea-4-programacion/blob/main/logs.txt): error log · Persistent file output for handled failures · `logs.txt`

## Connections

- main.py → Cliente: creates · Builds example or input-driven clients
- main.py → Servicio: uses · Composes service objects through the domain model
- main.py → ReservaSala: instantiates · Exercises room reservation flows
- main.py → AlquilerEquipo: instantiates · Exercises equipment rental flows
- main.py → Asesoria: instantiates · Exercises consulting flows
- main.py → Reserva: drives · Creates and tests reservation flows
- main.py → excepciones.py: handles · Routes failures through custom error types
- ReservaSala → Servicio: inherits · Concrete service extends the abstract base contract
- AlquilerEquipo → Servicio: inherits · Concrete service extends the abstract base contract
- Asesoria → Servicio: inherits · Concrete service extends the abstract base contract
- Reserva → Cliente: links · Reservation binds a customer
- Reserva → Servicio: links · Reservation binds a service
- Reserva → ClienteError: raises · Uses domain validation errors when client rules fail
- Reserva → ReservaError: raises · Uses workflow errors when reservation rules fail
- Reserva → DisponibilidadError: raises · Uses availability errors when capacity checks fail
- Cliente → ClienteError: raises · Client validation raises standardized errors
- Servicio → DisponibilidadError: raises · Base service validation can fail availability checks
- excepciones.py → SoftwareFJError: defines · Base exception class
- excepciones.py → ClienteError: defines · Client-specific exception class
- excepciones.py → ReservaError: defines · Reservation-specific exception class
- excepciones.py → DisponibilidadError: defines · Availability-specific exception class
- excepciones.py → logs.txt: writes · Appends error records to the log file
