# wes1101/exceptionfromcatan architecture

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

- Interactive diagram: https://gitdiagram.com/wes1101/exceptionfromcatan
- Repository: https://github.com/wes1101/exceptionfromcatan

## Overview

##### Project Type & Purpose
- This is a desktop full-stack application (pure Java) with a JavaFX-based GUI and a turn-based game engine (Settlers of Catan mechanics).
- Tech stack: Java 21, JavaFX (FXML), Maven for build, no external database (in-memory or file-based persistence may be added later).

##### Core Components
a. Presentation Layer (JavaFX UI)
- FXML views (src/main/resources/de/dhbw/app/hello-view.fxml)
- Scene graph, CSS (if any), resource files
b. Application Layer
- HelloApplication.java (entry point: Application.launch)
- HelloController.java (FXML controller binding UI events to logic)
c. Domain (Game) Layer
- GameManager, Board, Player, Resource, DevelopmentCard, TurnController, TradingService, VictoryConditionChecker (to be created under de.dhbw.app or subpackages)
d. Build & DevOps
- Maven (pom.xml, mvnw, .mvn)
- CI workflow (.github/workflows/maven.yml)
e. Documentation
- docs/FirstSetup, docs/ProjectStructure, CONTRIBUTING.md

##### Relationships & Data Flow
- The user interacts with the JavaFX UI (FXML view).
- UI events propagate to Controller methods (HelloController).
- Controllers invoke services in the Domain Layer (GameManager, TurnController, etc.).
- Domain Layer updates the Model (Board state, Player resources) and notifies the UI via JavaFX property bindings or observer callbacks.
- Maven handles compilation, test execution, packaging. CI workflow executes Maven goals on push/PR.

##### Architectural Patterns & Principles
- MVC (Model–View–Controller):
· View = FXML + JavaFX scene graph
· Controller = HelloController + any future controllers per view
· Model = domain classes (game state)
- Observer / Data Binding: JavaFX `ObservableValue`, `Property` for live UI updates.
- Single Responsibility: separate packages for UI, controllers, domain logic.
- Build isolation: externalize build config (pom.xml) from code.

##### Detailed Steps for the Principal Software Engineer
2. Under Presentation: place “hello-view.fxml” (UI), annotate with “JavaFX Scene”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        UI["hello-view.fxml"]:::ui
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        App["HelloApplication"]:::controller
        Ctrl["HelloController"]:::controller
        Module["module-info.java"]:::controller
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        GM["GameManager"]:::domain
        TC["TurnController"]:::domain
        TS["TradingService"]:::domain
        VC["VictoryConditionChecker"]:::domain
        Board["Board"]:::domain
        Player["Player"]:::domain
    end

    %% Build & CI
    subgraph "Build & CI"
        direction TB
        POM["pom.xml"]:::build
        MVNW["mvnw"]:::build
        MVNWCMD["mvnw.cmd"]:::build
        Wrapper[".mvn/wrapper/maven-wrapper.properties"]:::build
        CI[".github/workflows/maven.yml"]:::build
    end

    %% Documentation
    subgraph "Documentation"
        direction TB
        Setup["Setup.md"]:::docs
        GUIChart["GUIclassChart.md"]:::docs
        ModelChart["classChart.md"]:::docs
        MavenStruct["Maven_Folder_Structure.md"]:::docs
        Contrib["CONTRIBUTING.md"]:::docs
    end

    %% Connections Presentation->Application
    UI -->|"instantiate via FXMLLoader"| Ctrl
    App -->|"loadFXML()"| UI
    App -->|"launch() entry point"| Ctrl
    Module -->|"module boundary"| App

    %% Controller->Domain
    Ctrl -->|"invoke game logic"| GM

    %% Domain internal
    GM -->|"manage turn"| TC
    GM -->|"process trade"| TS
    GM -->|"check victory"| VC
    GM <-->|"update state"| Board
    GM <-->|"update state"| Player
    Board -->|"property change notifications"| UI

    %% Build & CI flow
    CI -->|"runs Maven build"| POM
    POM -->|"builds artifact"| POM
    POM -->|"uses wrapper"| MVNW
    POM -->|"uses wrapper"| MVNWCMD
    MVNW -->|"config from"| Wrapper

    %% Documentation links
    Setup
    GUIChart
    ModelChart
    MavenStruct
    Contrib

    %% Legend
    subgraph "Legend"
        direction TB
        L1["UI (blue)"]:::ui
        L2["Controller (green)"]:::controller
        L3["Domain (orange)"]:::domain
        L4["Build/CI (gray)"]:::build
        L5["Docs (white)"]:::docs
    end

    %% Click Events
    click UI "https://github.com/wes1101/exceptionfromcatan/blob/main/src/main/resources/de/dhbw/app/hello-view.fxml"
    click App "https://github.com/wes1101/exceptionfromcatan/blob/main/src/main/java/de/dhbw/app/HelloApplication.java"
    click Ctrl "https://github.com/wes1101/exceptionfromcatan/blob/main/src/main/java/de/dhbw/app/HelloController.java"
    click Module "https://github.com/wes1101/exceptionfromcatan/blob/main/src/main/java/module-info.java"
    click POM "https://github.com/wes1101/exceptionfromcatan/blob/main/pom.xml"
    click MVNW "https://github.com/wes1101/exceptionfromcatan/tree/main/mvnw"
    click MVNWCMD "https://github.com/wes1101/exceptionfromcatan/blob/main/mvnw.cmd"
    click Wrapper "https://github.com/wes1101/exceptionfromcatan/blob/main/.mvn/wrapper/maven-wrapper.properties"
    click CI "https://github.com/wes1101/exceptionfromcatan/blob/main/.github/workflows/maven.yml"
    click Setup "https://github.com/wes1101/exceptionfromcatan/blob/main/docs/FirstSetup/Setup.md"
    click GUIChart "https://github.com/wes1101/exceptionfromcatan/blob/main/docs/ProjectStructure/GUIclassChart.md"
    click ModelChart "https://github.com/wes1101/exceptionfromcatan/blob/main/docs/ProjectStructure/classChart.md"
    click MavenStruct "https://github.com/wes1101/exceptionfromcatan/blob/main/docs/ProjectStructure/Maven_Folder_Structure.md"
    click Contrib "https://github.com/wes1101/exceptionfromcatan/blob/main/CONTRIBUTING.md"

    %% Styles
    classDef ui fill:#E3F2FD,stroke:#90CAF9;
    classDef controller fill:#E8F5E9,stroke:#A5D6A7;
    classDef domain fill:#FFF3E0,stroke:#FFB74D;
    classDef build fill:#CFD8DC,stroke:#B0BEC5;
    classDef docs fill:#FFFFFF,stroke:#000000;
```
