# sidragosam/sfdev architecture

> Architecture diagram of the GitHub repository sidragosam/sfdev, 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/sidragosam/sfdev
- Repository: https://github.com/sidragosam/sfdev

## Overview

##### Main Components
- User Interface (View):
- The JavaFX-based UI is defined in the FXML file (bmi.fxml) and supported by the class org.openjfx.App.java.
- This as the “View” in an MVC pattern.
- Controller:
- The BmiController class in the Controller package handles user interactions.
- It takes input from the UI and communicates with the model.
- Model:
- The BMICalc class represents the business logic for calculating BMI.
- This is where the actual computation happens.
- Data Access Layer (DAO):
- The JSONLoadAndSave class in the Dao package manages reading and writing BMI data from/to the JSON file (adatok.json).
- This component encapsulates file I/O operations.
- Persistence/Resources:
- A JSON file (adatok.json) stored under resources that holds external data for comparison.

##### Relationships and Interactions
- After the calculation, the Controller uses the DAO (JSONLoadAndSave) to load competitor data and to save the new BMI value. Illustrate bi-directional communication between DAO and the JSON persistence layer.

##### Architectural Patterns and Design Principles
- MVC Pattern:
- Clearly separate the logic into three distinct layers (View, Controller, Model) with the DAO as an extra support component.
- Layer Separation:
- The UI (JavaFX and FXML) is separate from the business logic (BMICalc) and the data access operations (JSONLoadAndSave).
- Modularity:
- Maven structure indicates modular building and deployment, so include a note that build/deployment is managed by Maven (pom.xml, target/ directories).

##### Technologies, Frameworks, and Libraries
- Java and JavaFX (note the use of module-info.java pointing to module definitions).
- Maven for build and dependency management (pom.xml).
- JSON processing (likely via typical libraries, as inferred from JSONLoadAndSave).

##### Extra Notes for the Principal Software Engineer
- Although this is a relatively simple application, capturing every part—especially the separation of concerns—will help in future scalability or refactoring efforts.
- To show any relationships (like dependency injection or mediator patterns if they exist in your actual code implementation, even if not immediately clear from the file structure) that might be important later when expanding the application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    user["User"]:::user

    %% View Layer
    subgraph "View Layer"
        fxml["FXML (bmi.fxml)"]:::view
        app["JavaFX App (App.java)"]:::view
    end

    %% Controller Layer
    subgraph "Controller Layer"
        controller["Controller (BmiController)"]:::controller
    end

    %% Business/Model Layer
    subgraph "Business Layer"
        model["Model (BMICalc)"]:::model
    end

    %% Data Layer
    subgraph "Data Layer"
        dao["DAO (JSONLoadAndSave)"]:::dao
        data["JSON Data (adatok.json)"]:::dao
    end

    %% Build System
    subgraph "Build System"
        maven["Maven (pom.xml)"]:::build
    end

    %% Relationships
    user -->|"interacts"| fxml
    user -->|"interacts"| app

    fxml -->|"triggers"| controller
    app -->|"triggers"| controller

    controller -->|"calculates"| model
    model -- "feedback" --> controller

    controller -->|"accesses"| dao
    dao <-->|"readsWrites"| data

    controller -->|"updates"| fxml

    maven ---|"builds"| app

    %% Click Events
    click fxml "https://github.com/sidragosam/sfdev/blob/main/src/main/resources/org/openjfx/bmi.fxml"
    click app "https://github.com/sidragosam/sfdev/blob/main/src/main/java/org/openjfx/App.java"
    click controller "https://github.com/sidragosam/sfdev/blob/main/src/main/java/org/openjfx/Controller/BmiController.java"
    click model "https://github.com/sidragosam/sfdev/blob/main/src/main/java/org/openjfx/Model/BMICalc.java"
    click dao "https://github.com/sidragosam/sfdev/blob/main/src/main/java/org/openjfx/Dao/JSONLoadAndSave.java"
    click data "https://github.com/sidragosam/sfdev/blob/main/src/main/resources/org/openjfx/adatok.json"
    click maven "https://github.com/sidragosam/sfdev/blob/main/pom.xml"

    %% Styles
    classDef user fill:#FFEEAD,stroke:#333,stroke-width:2px;
    classDef view fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef controller fill:#C1FBA4,stroke:#333,stroke-width:2px;
    classDef model fill:#F7C5A0,stroke:#333,stroke-width:2px;
    classDef dao fill:#E0BBE4,stroke:#333,stroke-width:2px;
    classDef build fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
