# tyler-liquornik/canoe-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/tyler-liquornik/canoe-analysis
- Repository: https://github.com/tyler-liquornik/canoe-analysis

## Overview

##### Main Architectural Layers
- Presentation/UI Layer
- Application/Business Logic Layer
- Domain/Model Layer
- Infrastructure & Cross-Cutting Concerns

##### Layer and Create Its Sublayers

A. Presentation/UI Layer
- Overview: Handles user interface rendering, FXML-based views, window and scene management.
- Sublayers:
- View Layer: Contains FXML files for different views (e.g., main-view.fxml, beam-view.fxml, hull-builder-view.fxml, etc.) and associated CSS resources.
- Controller Layer: Includes all the Java controllers (e.g., MainController, BeamController, HullBuilderController, etc.) that manage user events and bind them with the underlying business logic.

B. Application/Business Logic Layer
- Overview: Contains the specific services and processes that implement the analysis and design functionality.
- Sublayers:
- Facade/Controller Interaction Sub-Layer: This acts as the interface between the controllers and the module services, ensuring that UI commands are translated into business operations.

C. Domain/Model Layer
- Overview: Represents core business entities, mathematical models, and engineering computations.
- Sublayers:
- Data Models Sub-Layer: Contains the “models” package that features classes such as Canoe, Hull, Load, Equation, etc.
- Functional Models Sub-Layer: Includes implementations of functions for analysis (e.g., CubicBezierFunction, BoundUnivariateFunction) and representation of functions carrying the calculus/engineering algorithms.
- AOP & Cross-Cutting Concerns Sub-Layer: Encapsulates aspects defined in the “aop” package, such as logging (TracingAspect), debouncing actions (DebounceAspect/Debouncer), and other behavioral modifications that are applied across multiple modules.

D. Infrastructure & Utility Layer
- Overview: Contains all lower-level utilities, configuration resources, and deployment scripts.
- Sublayers:
- Configuration & Resource Management: This involves resource files (YAML configurations, logback.xml), font and image resources, and settings used by the application.
- Utility Sub-Layer: Groups utility classes (CalculusUtils, GraphicsUtils, ControlUtils, etc.) that support both business logic and UI rendering.
- Deployment & Build Integration: Scripts and configuration files like pom.xml, deploy-mac.sh, deploy-pc.bat, Maven wrapper files that help in building and deploying the application.
- External Integrations: Any interfaces or APIs (like the mentioned image analysis API for the Percent Open Area Module) can be diagramed as external systems that interact with the application via specific service interfaces.

##### Relationships & Interactions
- From the Presentation Layer (controllers) to the Application Layer (module services) when users trigger actions (like solving a load case).
- From the Application Layer to the Domain Layer where data models are computed and updated.
- Callouts from the Domain Layer to the Utility Layer (e.g., utilities for calculation) and back to the Business Services layer.
- Bi-directional or cascading calls where AOP uses cross-layer concerns (e.g., logging aspects that wrap around business service calls).

##### Technologies, Frameworks & Design Patterns
- JavaFX (for UI and FXML-based views)
- Maven (for build management)
- AOP (for cross-cutting concerns like debouncing and tracing)
- MVC / MVVM-inspired separation: FXML views (view), Java controllers (controller), service classes and models (model)
- Domain-Driven Design aspects for modeling civil engineering concepts and calculations

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation/UI Layer
    subgraph "Presentation/UI Layer"
        subgraph "View Layer"
            VIEWS["FXML Views"]:::presentation
        end
        subgraph "Controller Layer"
            CONTROLLERS["Java Controllers"]:::presentation
        end
        subgraph "UI Component Sub-Layer"
            UI_COMPONENTS["Custom UI Components"]:::presentation
        end
    end

    %% Application/Business Logic Layer
    subgraph "Application/Business Logic Layer"
        subgraph "Module Services Sub-Layer"
            MODULE_SERVICES["Module Services (BeamSolver, DiagramService, HullGeometryService)"]:::business
        end
        subgraph "Facade/Controller Interaction Sub-Layer"
            CONTROLLER_FACADES["Controller Facades"]:::business
        end
        subgraph "Orchestration & Flow"
            ORCHESTRATION["Workflow Orchestration"]:::business
        end
    end

    %% Domain/Model Layer
    subgraph "Domain/Model Layer"
        subgraph "Data Models Sub-Layer"
            DATA_MODELS["Data Models (Canoe, Hull, Load, Equation)"]:::domain
        end
        subgraph "Functional Models Sub-Layer"
            FUNCTIONAL_MODELS["Functional Models (CubicBezierFunction, BoundUnivariateFunction)"]:::domain
        end
        subgraph "AOP & Cross-Cutting Concerns Sub-Layer"
            AOP_ASPECTS["AOP Aspects (Tracing, Debounce)"]:::domain
        end
    end

    %% Infrastructure & Utility Layer
    subgraph "Infrastructure & Utility Layer"
        subgraph "Configuration & Resource Management"
            CONFIGURATIONS["Configurations (YAML, Settings)"]:::infrastructure
            LOGBACK["Logback Configuration"]:::infrastructure
        end
        subgraph "Utility Sub-Layer"
            UTILITIES["Utilities (CalculusUtils, GraphicsUtils)"]:::infrastructure
        end
        subgraph "Deployment & Build Integration"
            POM["pom.xml"]:::infrastructure
            DEPLOY_MAC["deploy-mac.sh"]:::infrastructure
            DEPLOY_PC["deploy-pc.bat"]:::infrastructure
            MVNW["mvnw"]:::infrastructure
            MVNW_CMD["mvnw.cmd"]:::infrastructure
            MVN_FOLDER[".mvn (folder)"]:::infrastructure
        end
        subgraph "External Integrations"
            EXTERNAL_API["External API (Image Analysis)"]:::infrastructure
        end
    end

    %% Relationships & Interactions
    VIEWS -->|"triggers"| CONTROLLERS
    CONTROLLERS -->|"delegates"| CONTROLLER_FACADES
    CONTROLLER_FACADES -->|"calls"| MODULE_SERVICES
    MODULE_SERVICES -->|"coordinates"| ORCHESTRATION
    MODULE_SERVICES -->|"computes"| DATA_MODELS
    MODULE_SERVICES -->|"invokes"| EXTERNAL_API
    MODULE_SERVICES -->|"wrappedBy"| AOP_ASPECTS
    DATA_MODELS -->|"integrates"| FUNCTIONAL_MODELS
    DATA_MODELS -->|"utilizes"| UTILITIES
    UI_COMPONENTS -->|"enhances"| VIEWS
    CONFIGURATIONS -->|"configures"| CONTROLLERS
    CONFIGURATIONS -->|"configures"| MODULE_SERVICES
    LOGBACK -->|"configures"| MODULE_SERVICES
    UTILITIES -->|"assists"| MODULE_SERVICES

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef business fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef domain fill:#FFD580,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#D3D3D3,stroke:#000,stroke-width:2px;

    %% Click Events
    click VIEWS "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/resources/com/wecca/canoeanalysis/view"
    click CONTROLLERS "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/controllers"
    click UI_COMPONENTS "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/components"
    click MODULE_SERVICES "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/services"
    click CONTROLLER_FACADES "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/controllers/modules"
    click DATA_MODELS "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/models"
    click FUNCTIONAL_MODELS "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/models/function"
    click AOP_ASPECTS "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/aop"
    click CONFIGURATIONS "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/resources/com/wecca/canoeanalysis/settings"
    click LOGBACK "https://github.com/tyler-liquornik/canoe-analysis/blob/master/src/main/resources/logback.xml"
    click UTILITIES "https://github.com/tyler-liquornik/canoe-analysis/tree/master/src/main/java/com/wecca/canoeanalysis/utils"
    click POM "https://github.com/tyler-liquornik/canoe-analysis/blob/master/pom.xml"
    click DEPLOY_MAC "https://github.com/tyler-liquornik/canoe-analysis/blob/master/deploy-mac.sh"
    click DEPLOY_PC "https://github.com/tyler-liquornik/canoe-analysis/blob/master/deploy-pc.bat"
    click MVNW "https://github.com/tyler-liquornik/canoe-analysis/tree/master/mvnw"
    click MVNW_CMD "https://github.com/tyler-liquornik/canoe-analysis/blob/master/mvnw.cmd"
    click MVN_FOLDER "https://github.com/tyler-liquornik/canoe-analysis/blob/master/.mvn"
```
