# glassesneo/oolib architecture

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

- Interactive diagram: https://gitdiagram.com/glassesneo/oolib
- Repository: https://github.com/glassesneo/oolib

## Overview

##### Main Components
- Core Module: Represent the entry point (src/oolib.nim) which ties together the functionality supplied by the rest of the package.
- Classes Subsystem: Show the modules under src/oolib/classes (such as normal_class.nim, distinct_class.nim, named_tuple_class.nim, constructor_pragma.nim, and class_util.nim) as one grouped component. This subsystem handles the creation and management of classes, along with automatic constructor generation and other OOP features.
- Protocols Subsystem: Represent the protocols modules (src/oolib/protocols/protocol_core.nim and protocol_util.nim). This part offers Kotlin-like interfaces with succinct getter/setter definitions and supports integration with classes.
- Tests: Include the tests folder component, outlining that there are specific test cases verifying functionalities like class implementations, protocol usage, instance checking (isInstanceOf), and configurations. This ensures that each of the components operates as expected.

##### Relationships and Interactions
- Within the Classes subsystem, demonstrate that different class types (normal, distinct, named tuple, etc.) interconnect via helper routines or shared utilities (e.g., class_util.nim).
- A “Build/CI” section to show the automation and integration running tests using the workflow defined in .github/workflows.

##### Architectural Patterns and Technologies
- Since OOlib is designed to facilitate object oriented programming in Nim, emphasize the separation of concerns: one distinct layer for classes and another for protocols.
- That the project follows a modular design pattern – separating functionalities into different directories/modules for clarity and extensibility.
- Mention any build/dependency management aspects (like the nimble package file oolib.nimble, nim.cfg configuration, and the devbox.json/lock) to reinforce that this project integrates with Nim’s tooling ecosystem.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main Components
    CoreModule["Core (src/oolib.nim) – Main Export & Aggregator"]:::core
    ClassesSubsystem["Classes Subsystem (normal_class, distinct_class, named_tuple_class, constructor_pragma, class_util, implement_class)"]:::subsystem
    ProtocolsSubsystem["Protocols Subsystem (protocol_core, protocol_util)"]:::subsystem
    Tests["Tests (classes,constructor,distinct_type,implementation,is_instanceof,named_tuple,config)"]:::tests

    %% Supporting Components in Docs & CI
    subgraph "Docs & CI"
        Documentation["Documentation (doc.md)"]:::docs
        NimConfig["Configuration (nim.cfg)"]:::docs
        Workflow["CI Workflow (.github/workflows/test.yml)"]:::docs
    end

    %% Relationships
    CoreModule -->|"exports"| ClassesSubsystem
    CoreModule -->|"exports"| ProtocolsSubsystem

    Tests -->|"tests"| CoreModule
    Tests -->|"tests"| ClassesSubsystem
    Tests -->|"tests"| ProtocolsSubsystem

    Workflow -->|"triggers"| Tests

    %% Click Events
    click CoreModule "https://github.com/glassesneo/oolib/blob/develop/src/oolib.nim"
    click ClassesSubsystem "https://github.com/glassesneo/oolib/tree/develop/src/oolib/classes"
    click ProtocolsSubsystem "https://github.com/glassesneo/oolib/tree/develop/src/oolib/protocols"
    click Tests "https://github.com/glassesneo/oolib/tree/develop/tests"
    click Documentation "https://github.com/glassesneo/oolib/blob/develop/docs/doc.md"
    click NimConfig "https://github.com/glassesneo/oolib/blob/develop/nim.cfg"
    click Workflow "https://github.com/glassesneo/oolib/blob/develop/.github/workflows/test.yml"

    %% Styles
    classDef core fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef subsystem fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef tests fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef docs fill:#ffd699,stroke:#333,stroke-width:2px;
```
