# adam-kan/vlsm-gui-calculator-ipv4 architecture

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

- Interactive diagram: https://gitdiagram.com/adam-kan/vlsm-gui-calculator-ipv4
- Repository: https://github.com/adam-kan/vlsm-gui-calculator-ipv4

## Overview

##### Project Type and Purpose
- This is a desktop GUI application written in Python.
- Purpose: allow users (networking students/professionals) to input an IPv4 network and host requirements, validate input, compute Variable Length Subnet Masks (VLSM), and present the results in a dynamic table.

##### File-Structure Analysis
- gui_vlsm.py: the entry point and GUI layer (view + controller).
- vlsm_logic.py: the core computation layer (model).
- requirements.txt: lists dependencies (customtkinter, Python 3.8+).
- README.md: describes functionality and usage.

##### Main Components
a. User (Actor)
b. GUI Layer (customtkinter)
– Input Form
– Validation Submodule
– Display/Table Submodule
c. Logic Layer (vlsm_logic module)
– IP Validation Functions
– Subnet Size Calculators
– Range Generators
d. External Library Dependencies
– customtkinter (UI toolkit)
– Python built-in ipaddress (if used)
e. Optional: Error Handling & Logging

##### Component Interactions
- User → GUI Input Form: enters network IP, host counts.
- GUI → Validation Submodule: checks format and range.
- Validation → Logic Layer: calls IP/subnet calculation functions.
- Logic Layer → returns subnet ranges, masks, hosts to GUI.
- GUI Display Submodule → renders a table of subnets.
- GUI ↔ Error Handler: displays alerts on invalid input.

##### Architectural Patterns and Principles
- MVC-inspired separation:
- View (widgets, tables)
- Controller (event handlers in gui_vlsm.py)
- Model (vlsm_logic.py)
- Single responsibility: UI code vs. computation code.
- Clear module boundaries simplify testing and maintenance.

##### Detail and Clarity
- Related UI elements (inputs, buttons, tables) under the GUI module.
- Within the Logic module, optionally subdivide into IP parser, mask calculator, and result formatter.

## Diagram (Mermaid)

```mermaid
flowchart TB
    user((User)):::actor

    subgraph "GUI Layer"
        direction TB
        inputForm["Input Form"]:::gui
        validation["Validation Submodule"]:::gui
        display["Display/Table Submodule"]:::gui
    end

    subgraph "Logic Layer"
        direction TB
        ipValid["IP Validation Functions"]:::logic
        sizeCalc["Subnet Size Calculators"]:::logic
        rangeGen["Range Generators"]:::logic
    end

    extLib["External Libraries"]:::lib
    doc["Documentation"]:::doc

    user -->|"IP & host counts"| inputForm
    inputForm -->|"raw input"| validation
    validation -->|"validated IPs"| ipValid
    validation -->|"valid counts"| sizeCalc
    ipValid --> sizeCalc
    sizeCalc --> rangeGen
    rangeGen -->|"subnet table data"| display
    validation -->|"error alerts"| display

    extLib -.-> inputForm
    extLib -.-> validation
    extLib -.-> ipValid
    extLib -.-> sizeCalc
    extLib -.-> rangeGen

    doc -.-> user

    click inputForm "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/gui_vlsm.py"
    click validation "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/gui_vlsm.py"
    click display "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/gui_vlsm.py"
    click ipValid "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/vlsm_logic.py"
    click sizeCalc "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/vlsm_logic.py"
    click rangeGen "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/vlsm_logic.py"
    click extLib "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/requirements.txt"
    click doc "https://github.com/adam-kan/vlsm-gui-calculator-ipv4/blob/main/README.md"

    classDef gui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef logic fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef lib fill:#FFA500,stroke:#000,stroke-width:1px
    classDef doc fill:#F0E68C,stroke:#000,stroke-width:1px
    classDef actor fill:#FFFFFF,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5
```
