add-evaluation-tool

Architecture Document

Table of Contents

  1. Interactive prototype
  2. Context diagram (example)
  3. Use case diagram (example)
  4. Component diagram (example, code)
  5. Sequence diagrams

Interactive prototype

Link to the interactive prototype in Figma: Figma link

Context diagram (example)

Source: docs/architecture/assets/context.mmd

graph TD
    subgraph "Architecture Evaluation Tool"
        AET["Architecture Evaluation Tool"]
    end

    subgraph "External Actors"
        User["User"]
    end

    subgraph "External Systems"
        PlantUML[("PlantUML Renderer")]
        Storage[("Local Storage / Database")]
    end

    %% Interactions
    User <-->|"Use web UI"| AET

    AET -->|"Render component diagrams"| PlantUML
    AET -->|"Store diagrams, matrices, diffs"| Storage

External actors

Use case diagram (example)

Source: docs/architecture/assets/use-cases.mmd

flowchart TD
    subgraph Actors
        User["User"]
    end

    subgraph UseCases
        UC1(["Upload PlantUML Diagram"]):::uc
        UC2(["Evaluate Architecture Matrix"]):::uc
        UC3(["Compare Versions (Diff)"]):::uc
        UC4(["Export Report"]):::uc
    end

    classDef uc fill:#eef,stroke:#336,stroke-width:1px

    User --> UC1
    User --> UC2
    User --> UC3
    User --> UC4

Actors

Component diagram (example, code)

Source: docs/architecture/assets/components.puml

@startuml
skinparam componentStyle rectangle
skinparam wrapWidth 200
skinparam maxMessageSize 200

package "Architecture Evaluation Tool" {
  [Web UI] as WebUI
  [Upload Controller] as UploadController
  [PlantUML Parser] as Parser
  [Matrix Engine] as MatrixEngine
  [Diff Engine] as DiffEngine
  [Renderer Adapter] as RendererAdapter
  [Storage] as Storage
}

WebUI --> UploadController : upload .puml
UploadController --> Parser : parse components
Parser --> MatrixEngine : build matrix model
WebUI --> MatrixEngine : edit scores / weights
WebUI --> DiffEngine : compare versions
MatrixEngine --> Storage : persist evaluations
DiffEngine --> Storage : read prior versions
WebUI --> RendererAdapter : preview diagram
RendererAdapter --> Parser : leverage PlantUML libs

note right of MatrixEngine
  Calculates derived metrics and
  quality attribute scores
end note

note right of DiffEngine
  Computes structural/metric diffs
  between two architecture versions
end note

@enduml

Component responsibilities

Sequence diagrams

User story: Upload PlantUML and evaluate

Source: docs/architecture/assets/seq-user-story.mmd

sequenceDiagram
    participant User as User
    participant UI as Browser UI
    participant API as Backend API
    participant Parser as PlantUML Parser
    participant Matrix as Matrix Engine
    participant Store as Storage

    User->>UI: Select .puml and start evaluation
    UI->>API: POST /diagrams (file)
    API->>Parser: Parse components/relations
    Parser-->>API: Parsed model
    API->>Matrix: Initialize evaluation matrix
    Matrix-->>API: Matrix model
    API->>Store: Persist diagram + matrix
    Store-->>API: Saved
    API-->>UI: 201 Created + matrix data
    UI->>UI: Render matrix and metrics

User story: Compare versions (Diff)

Source: docs/architecture/assets/seq-diff.mmd

sequenceDiagram
    participant User as User
    participant UI as Browser UI
    participant API as Backend API
    participant Store as Storage
    participant Diff as Diff Engine
    participant Render as Renderer Adapter

    User->>UI: Select Version A and Version B
    UI->>API: GET /diff?from=A&to=B
    API->>Store: Fetch snapshot A
    Store-->>API: Snapshot A
    API->>Store: Fetch snapshot B
    Store-->>API: Snapshot B
    API->>Diff: Compute structural + metric diff
    Diff-->>API: Diff summary + changed elements
    API->>Render: Generate PlantUML diff preview
    Render-->>API: Diff image/URL
    API-->>UI: Diff payload (summary + visuals)
    UI->>UI: Display changes and progress indicators

Quality requirement: Responsive Matrix Interaction (QAS201)

Derived from docs/requirements/quality-requirements.md#performance (QAS201: input-to-visual-update under 100ms).

Source: docs/architecture/assets/seq-qas.mmd

sequenceDiagram
    %% QAS201: Responsive Matrix Interaction (<100ms)
    participant User as User
    participant UI as Browser UI
    participant Calc as Client-side Matrix Engine
    participant API as Backend API

    User->>UI: Edit cell (score/weight)
    UI->>Calc: Recompute derived metrics (debounced)
    Calc-->>UI: Updated totals/visuals
    UI->>UI: Update DOM (under 100ms)
    Note over UI: Optimistic UI, Web Worker if needed

    alt Background sync (throttled)
        UI->>API: PATCH /matrix (delta)
        API-->>UI: 200 OK
    end

Design decisions

This section documents the five most important architectural decisions made during the design phase, including the rationale, alternatives considered, and trade-offs.

1. Hexagonal Architecture (Ports and Adapters Pattern)

Decision: Adopt hexagonal architecture with clear separation between domain, application, and infrastructure layers.

Rationale:

Alternatives Considered:

Trade-offs:

Implementation:

Impact: This decision enables the team to develop and test core functionality independently of storage and parsing implementations, supporting iterative development and early validation.


2. Client-Side Matrix Computation for Performance

Decision: Perform matrix calculations and updates on the client-side (Flutter Web) with optimistic UI updates and background synchronization to the backend.

Rationale:

Alternatives Considered:

Trade-offs:

Implementation:

Impact: This decision directly addresses the performance quality requirement (QAS201) and enables the responsive matrix interaction that is critical for user satisfaction.


3. Docker-Based Deployment Strategy

Decision: Package the entire application (frontend, backend, nginx) using Docker Compose for single-command deployment.

Rationale:

Alternatives Considered:

Trade-offs:

Implementation:

Impact: This decision enables frequent customer demos and early feedback cycles, which were emphasized as critical for project success. It also supports the educational use case where students need quick, reliable deployment.


4. PlantUML as Primary Input Format with Regex-Based Parser

Decision: Use PlantUML component diagrams as the standard input format and implement a regex-based parser for component and relationship extraction.

Rationale:

Alternatives Considered:

Trade-offs:

Implementation:

Impact: This decision establishes the foundation for all functionality. The parser’s accuracy (QAS302) directly affects the quality of the evaluation matrix. The regex approach allows rapid MVP delivery while maintaining the option to migrate to a library-based parser if needed.


5. Separation of Parsing, Storage, and Evaluation Concerns

Decision: Implement parsing, storage, and evaluation as independent, composable services with clear interfaces.

Rationale:

Alternatives Considered:

Trade-offs:

Implementation:

Impact: This decision enables the team to deliver functionality incrementally (parsing in Sprint 2, matrix in Sprint 3, diff in Sprint 5) while maintaining clean architecture. It also supports the contingency plan of swapping parsers if PlantUML parsing proves unreliable.


Notes on Design Decisions:


Notes:

Progress tracking: