# henipatel1009/ruburger architecture

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

- Interactive diagram: https://gitdiagram.com/henipatel1009/ruburger
- Repository: https://github.com/henipatel1009/ruburger

## Overview

##### Main Components
- Application Entry Point: Main.java initiates the program.
- Models: Classes under the model package (e.g., Burger.java, Sandwich.java, Combo.java, Beverage.java, AddOns.java, etc.) represent the data and business logic for menu items, order details, and price calculations.
- Controllers: Classes under the controller package (e.g., MainController.java, CurrentOrderController.java, AllOrdersController.java, BeverageController.java, BurgerController.java, ComboController.java, SandwichController.java, SideController.java). These act as the intermediaries between the user interface and the business logic.
- Views: FXML files in the resources directory (e.g., MainView.fxml, CurrentOrderView.fxml, AllOrdersView.fxml, etc.) handle the UI, with CSS styling and images provided in the resources folder.
- Tests: JUnit tests (e.g., SandwichTest.java and BurgerTest.java) ensure that the pricing and business logic work as expected.
- External Dependencies: JavaFX (for UI) and JUnit 5 (for testing) are essential technologies.

##### Relationships and Interactions
- Data Flow:
- The Main.java entry point launches the application, triggering the initialization of controllers and loading associated FXML views.
- Controllers respond to user actions (usually via pop-up dialogs) and communicate with the model classes to create, customize, and manage orders.
- The view layer (FXMLs) is connected to controllers, and data is rendered dynamically via JavaFX components.
- MVC Communication:
- Controllers retrieve and update data from models.
- Views capture user input through dialogs and pass requests to controllers.
- The model layer processes business logic including dynamic price calculation and order management.

##### Architectural Patterns and Design Principles
- MVC Pattern: Clearly segmented into model (data and business logic), view (FXML, CSS, images), and controller (event handling and UI control).
- Layered Architecture: Logical separation between user interface, business logic, and testing.
- Testing Suite: Use of JUnit tests indicates a commitment to unit testing for validating core functionalities (like price calculations).

##### Additional Elements
- A component for external libraries: Illustrate the role of JavaFX (UI framework) and JUnit 5 (testing framework).

- Top - Controller Layer: Encompass all controller classes.
- Middle - Model Layer: Encompass all model classes and business logic.
- Bottom - View Layer: Include the FXML files, images, and CSS styling.
- From Main.java (placed at the top or in a central “Entry Point” node) to the controllers.
- From each controller to its corresponding model classes.
- From controllers to the FXML views to indicate user interface updates.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "RU Burger Ordering System"
        A["Main.java"]:::entry

        subgraph "Controller Layer"
            B1["MainController.java"]:::controller
            B2["CurrentOrderController.java"]:::controller
            B3["AllOrdersController.java"]:::controller
            B4["BurgerController.java"]:::controller
            B5["SandwichController.java"]:::controller
            B6["ComboController.java"]:::controller
            B7["BeverageController.java"]:::controller
            B8["SideController.java"]:::controller
        end

        subgraph "Model Layer"
            M1["Burger.java"]:::model
            M2["Sandwich.java"]:::model
            M3["Combo.java"]:::model
            M4["Beverage.java"]:::model
            M5["AddOns.java"]:::model
            M6["Side.java"]:::model
            M7["MenuItem.java"]:::model
            M8["Order.java"]:::model
            M9["OrderManager.java"]:::model
            M10["Bread.java"]:::model
            M11["Flavor.java"]:::model
            M12["Protein.java"]:::model
            M13["SideType.java"]:::model
            M14["Size.java"]:::model
        end

        subgraph "View Layer"
            V1["MainView.fxml"]:::view
            V2["CurrentOrderView.fxml"]:::view
            V3["AllOrdersView.fxml"]:::view
            V4["BeverageView.fxml"]:::view
            V5["BurgerView.fxml"]:::view
            V6["ComboController.fxml"]:::view
            V7["SandwichView.fxml"]:::view
            V8["SideView.fxml"]:::view
            V9["styles.css"]:::view
            V10["images"]:::view
        end

        subgraph "Testing Suite"
            T1["BurgerTest.java"]:::test
            T2["SandwichTest.java"]:::test
        end

        subgraph "External Dependencies"
            E1["JavaFX"]:::external
            E2["JUnit5"]:::external
        end
    end

    %% Arrows from Entry Point to Controller Layer
    A -->|"launches"| B1

    %% Controller to View connections
    B1 -->|"rendersUI"| V1
    B2 -->|"rendersUI"| V2
    B3 -->|"rendersUI"| V3
    B4 -->|"rendersUI"| V5
    B5 -->|"rendersUI"| V7
    B6 -->|"rendersUI"| V6
    B7 -->|"rendersUI"| V4
    B8 -->|"rendersUI"| V8

    %% Controller to Model connections
    B1 -->|"initializesMenu"| M7
    B1 -->|"configures"| M10
    B1 -->|"configures"| M11
    B1 -->|"configures"| M12
    B1 -->|"configures"| M13
    B1 -->|"configures"| M14
    B2 -->|"updatesOrder"| M8
    B3 -->|"managesOrder"| M9
    B4 -->|"updatesOrderData"| M1
    B4 -->|"includesAddOns"| M5
    B5 -->|"updatesOrderData"| M2
    B6 -->|"updatesOrderData"| M3
    B7 -->|"updatesOrderData"| M4
    B8 -->|"updatesOrderData"| M6

    %% Testing connections to Models
    T1 -->|"validates"| M1
    T2 -->|"validates"| M2

    %% External Dependencies connections
    E1 -->|"supports"| B1
    E1 -->|"supports"| V1
    E1 -->|"supports"| V2
    E1 -->|"supports"| V3
    E1 -->|"supports"| V4
    E1 -->|"supports"| V5
    E1 -->|"supports"| V6
    E1 -->|"supports"| V7
    E1 -->|"supports"| V8
    E2 -->|"runsTests"| T1
    E2 -->|"runsTests"| T2

classDef entry fill:#f9e79f,stroke:#d35400,stroke-width:2px;
classDef controller fill:#85c1e9,stroke:#2874a6,stroke-width:2px;
classDef model fill:#82e0aa,stroke:#229954,stroke-width:2px;
classDef view fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
classDef test fill:#d2b4de,stroke:#8e44ad,stroke-width:2px;
classDef external fill:#f0f3f4,stroke:#616a6b,stroke-width:2px;

click A "https://github.com/henipatel1009/ruburger/blob/main/Main.java"
click B1 "https://github.com/henipatel1009/ruburger/blob/main/controller/MainController.java"
click B2 "https://github.com/henipatel1009/ruburger/blob/main/controller/CurrentOrderController.java"
click B3 "https://github.com/henipatel1009/ruburger/blob/main/controller/AllOrdersController.java"
click B4 "https://github.com/henipatel1009/ruburger/blob/main/controller/BurgerController.java"
click B5 "https://github.com/henipatel1009/ruburger/blob/main/controller/SandwichController.java"
click B6 "https://github.com/henipatel1009/ruburger/blob/main/controller/ComboController.java"
click B7 "https://github.com/henipatel1009/ruburger/blob/main/controller/BeverageController.java"
click B8 "https://github.com/henipatel1009/ruburger/blob/main/controller/SideController.java"
click M1 "https://github.com/henipatel1009/ruburger/blob/main/model/Burger.java"
click M2 "https://github.com/henipatel1009/ruburger/blob/main/model/Sandwich.java"
click M3 "https://github.com/henipatel1009/ruburger/blob/main/model/Combo.java"
click M4 "https://github.com/henipatel1009/ruburger/blob/main/model/Beverage.java"
click M5 "https://github.com/henipatel1009/ruburger/blob/main/model/AddOns.java"
click M6 "https://github.com/henipatel1009/ruburger/blob/main/model/Side.java"
click M7 "https://github.com/henipatel1009/ruburger/blob/main/model/MenuItem.java"
click M8 "https://github.com/henipatel1009/ruburger/blob/main/model/Order.java"
click M9 "https://github.com/henipatel1009/ruburger/blob/main/model/OrderManager.java"
click M10 "https://github.com/henipatel1009/ruburger/blob/main/model/Bread.java"
click M11 "https://github.com/henipatel1009/ruburger/blob/main/model/Flavor.java"
click M12 "https://github.com/henipatel1009/ruburger/blob/main/model/Protein.java"
click M13 "https://github.com/henipatel1009/ruburger/blob/main/model/SideType.java"
click M14 "https://github.com/henipatel1009/ruburger/blob/main/model/Size.java"
click V1 "https://github.com/henipatel1009/ruburger/blob/main/resources/MainView.fxml"
click V2 "https://github.com/henipatel1009/ruburger/blob/main/resources/CurrentOrderView.fxml"
click V3 "https://github.com/henipatel1009/ruburger/blob/main/resources/AllOrdersView.fxml"
click V4 "https://github.com/henipatel1009/ruburger/blob/main/resources/BeverageView.fxml"
click V5 "https://github.com/henipatel1009/ruburger/blob/main/resources/BurgerView.fxml"
click V6 "https://github.com/henipatel1009/ruburger/blob/main/resources/ComboController.fxml"
click V7 "https://github.com/henipatel1009/ruburger/blob/main/resources/SandwichView.fxml"
click V8 "https://github.com/henipatel1009/ruburger/blob/main/resources/SideView.fxml"
click V9 "https://github.com/henipatel1009/ruburger/blob/main/resources/styles.css"
click V10 "https://github.com/henipatel1009/ruburger/tree/main/resources/images"
click T1 "https://github.com/henipatel1009/ruburger/blob/main/test/BurgerTest.java"
click T2 "https://github.com/henipatel1009/ruburger/blob/main/test/SandwichTest.java"
```
