How luis-lop-nas/examen-sorpresa works
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.