# alejoordonez02/algodefense architecture

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

- Interactive diagram: https://gitdiagram.com/alejoordonez02/algodefense
- Repository: https://github.com/alejoordonez02/algodefense

## Overview

##### Main Components
- Application Entry Point: Highlight the Main.java and SystemInfo.java in the edu.fiuba.algo3 package as the starting point for the application.
- Controllers: Include a “Controllers” layer representing classes such as ControladorBotonDefensas, ControladorBotonJugar, ControladorJuego, etc. These are responsible for handling user actions and game events.
- Model: Show the “Model” layer which comprises game entities like Jugador, Juego, Defensa, Enemigo, Mapa, Parcela, Torre, and other domain classes. Note how some classes implement behaviors (e.g., strategies like CaminarSobrePasarela and movement interfaces such as Movedor).
- Views: Represent the “Views” layer with UI classes from the vistas package like VistaJuego, VistaMapa, VistaDefensas, and more. This layer deals with the graphical or textual presentation of the game state.
- Repositories: Represent the persistence layer containing repository classes such as JsonEnemyRepository and JsonMapRepository that load configuration or game data from JSON files.
- External & Utility Components: Include external scripts (build.sh, package.sh, etc.), Docker configuration (Dockerfile and docker-compose.yaml), and the build system (pom.xml, dependency-reduced-pom.xml) as part of the deployment and infrastructure tooling.

##### Depicting Relationships and Interactions
- That the model communicates with the repositories for updating or loading game configuration (from JSON files).
- That the Main class at start-up initiates the controllers and views, kickstarting the event loop.
- Optionally, point out integration points with Docker and CI/CD (via .github and travis configurations) to show the complete lifecycle from development to deployment.

##### Architectural Patterns and Design Principles
- MVC pattern: Clearly separate the Model (business logic), the Controllers (input processing and game rules), and the Views (presentation). Include a note that the “diagramaMVC.puml” is a documented artifact of this design.
- Layered architecture that supports clean separation of concerns.

##### Relevant Technologies and Frameworks
- Java is the primary language, with Maven for builds (pom.xml) and standard Java packages arranged under edu.fiuba.algo3.
- Docker is used for deployment, as evidenced by the docker folder and associated scripts.
- Testing frameworks are also present (multiple tests under src/main/test) to verify proper functionality.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Entry Point"
        MainEntry["Main.java"]:::entrypoint
        SystemInfo["SystemInfo.java"]:::entrypoint
    end

    subgraph "Game Controllers"
        Controllers["Controllers Layer"]:::controllers
    end

    subgraph "Domain Model"
        Model["Model Layer"]:::model
    end

    subgraph "UI Views"
        Views["Views Layer"]:::views
    end

    subgraph "JSON Repositories"
        Repos["Repositories Layer"]:::repositories
    end

    MainEntry -->|"init"| Controllers
    MainEntry -->|"init"| Views
    Views -->|"triggers"| Controllers
    Controllers -->|"updates"| Model
    Model -->|"persists"| Repos
    Model -->|"notifies"| Views

    subgraph "Infrastructure"
        subgraph "Build Scripts"
            b1["build.sh"]:::infrastructure
            b2["package.sh"]:::infrastructure
            b3["render_diagrams.sh"]:::infrastructure
            b4["start_services.sh"]:::infrastructure
        end
        subgraph "Docker"
            d1["Dockerfile"]:::infrastructure
            d2["docker-compose.yaml"]:::infrastructure
        end
        subgraph "Build System & CI"
            bs1["pom.xml"]:::infrastructure
            bs2["dependency-reduced-pom.xml"]:::infrastructure
            ci1[".github/workflows"]:::infrastructure
            ci2[".travis.yml"]:::infrastructure
        end
        subgraph "Documentation"
            doc1["diagramas"]:::infrastructure
            doc2["README.md"]:::infrastructure
            doc3["INFORME.md"]:::infrastructure
            doc4["docs/"]:::infrastructure
        end
    end

    click MainEntry "https://github.com/alejoordonez02/algodefense/blob/main/src/main/java/edu/fiuba/algo3/Main.java"
    click SystemInfo "https://github.com/alejoordonez02/algodefense/blob/main/src/main/java/edu/fiuba/algo3/SystemInfo.java"
    click Controllers "https://github.com/alejoordonez02/algodefense/tree/main/src/main/java/edu/fiuba/algo3/controladores"
    click Model "https://github.com/alejoordonez02/algodefense/tree/main/src/main/java/edu/fiuba/algo3/modelo"
    click Views "https://github.com/alejoordonez02/algodefense/tree/main/src/main/java/edu/fiuba/algo3/vistas"
    click Repos "https://github.com/alejoordonez02/algodefense/tree/main/src/main/java/edu/fiuba/algo3/repositories"
    click b1 "https://github.com/alejoordonez02/algodefense/blob/main/scripts/build.sh"
    click b2 "https://github.com/alejoordonez02/algodefense/blob/main/scripts/package.sh"
    click b3 "https://github.com/alejoordonez02/algodefense/blob/main/scripts/render_diagrams.sh"
    click b4 "https://github.com/alejoordonez02/algodefense/blob/main/scripts/start_services.sh"
    click d1 "https://github.com/alejoordonez02/algodefense/tree/main/docker/Dockerfile"
    click d2 "https://github.com/alejoordonez02/algodefense/blob/main/docker/docker-compose.yaml"
    click bs1 "https://github.com/alejoordonez02/algodefense/blob/main/pom.xml"
    click bs2 "https://github.com/alejoordonez02/algodefense/blob/main/dependency-reduced-pom.xml"
    click ci1 "https://github.com/alejoordonez02/algodefense/tree/main/.github/workflows"
    click ci2 "https://github.com/alejoordonez02/algodefense/blob/main/.travis.yml"
    click doc1 "https://github.com/alejoordonez02/algodefense/tree/main/diagramas/"
    click doc2 "https://github.com/alejoordonez02/algodefense/blob/main/README.md"
    click doc3 "https://github.com/alejoordonez02/algodefense/blob/main/INFORME.md"
    click doc4 "https://github.com/alejoordonez02/algodefense/tree/main/docs/"

    classDef entrypoint fill:#A7C7E7,stroke:#1A5276,stroke-width:2px;
    classDef controllers fill:#D5F5E3,stroke:#229954,stroke-width:2px;
    classDef model fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef views fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef repositories fill:#FCF3CF,stroke:#B7950B,stroke-width:2px;
    classDef infrastructure fill:#E8F8F5,stroke:#117864,stroke-width:2px;
```
