# akiratomori/slang-word architecture

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

- Interactive diagram: https://gitdiagram.com/akiratomori/slang-word
- Repository: https://github.com/akiratomori/slang-word

## Overview

##### Project type and purpose
- This is a standalone Java desktop application (built on JDK 17) that uses Java Swing for its GUI.
- It implements a “Slang Word Dictionary” with features to search by slang or definition, view search history, manage (add/edit/delete) entries, and play quiz‐style games.

##### File structure
- Top level:
- Main.java – application entry point
- slang.txt, history.txt, mySlang.txt – persistent data storage (dictionary and user history)
- Slang-Word.jar – build artifact, plus misc. docs
- source/
- model/ – business‐logic and data‐access classes:
– FileManager.java (loads & saves text files)
– SlangWord, SlangWordList, ListSlang (data structures)
– HistorySearch (manages search history)
- util/ – ConsoleIO.java (console‐based I/O for testing)
- views/ – Swing GUI pages, organized by feature:
– search/ (SearchPage, SearchSlangPage, SearchDefinitionPage, HistoryPage)
– manage/ (ManagePage, AddPage, EditPage, DeletePage)
– game/ (GamePage, FindSlangPage, FindDefinitionPage)
- Home.java – the main launcher GUI that routes to feature pages.

##### Extract insights from the README
- Confirms MVC‐style separation: data (“data/” aka .txt files), utilities (“ulti/” → util/), and UI pages.
- Describes functional groupings: /search, /manage, /game.
- Deployment: run with “java Main” or extract the JAR.

##### Detail
- Break out major pages as subcomponents or group them under a “Views” container
- That ManagePage orchestrates Add/Edit/DeletePage dialogs
- Interactions during a quiz: GamePage → FindSlangPage/FindDefinitionPage → Model
- Don’t omit the user‐history flow: every search → HistorySearch → history.txt

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point
    Main["Main.java"]:::entry
    Home["Home.java"]:::entry

    %% View Layer
    subgraph "Presentation Layer (Swing Views)"
        class DefView view
        SearchPage["SearchPage"]:::view
        SearchSlangPage["SearchSlangPage"]:::view
        SearchDefinitionPage["SearchDefinitionPage"]:::view
        HistoryPage["HistoryPage"]:::view
        ManagePage["ManagePage"]:::view
        AddPage["AddPage"]:::view
        EditPage["EditPage"]:::view
        DeletePage["DeletePage"]:::view
        GamePage["GamePage"]:::view
        FindSlangPage["FindSlangPage"]:::view
        FindDefinitionPage["FindDefinitionPage"]:::view
    end

    %% Utility Layer
    ConsoleIO["ConsoleIO"]:::util

    %% Model Layer
    subgraph "Domain & Business Logic"
        FileManager["FileManager"]:::model
        HistorySearch["HistorySearch"]:::model
        SlangWordList["SlangWordList"]:::model
        SlangWord["SlangWord"]:::model
        ListSlang["ListSlang"]:::model
    end

    %% Persistence Layer
    subgraph "Persistence (Flat Files)"
        style Persistence fill:#cccccc,stroke:#333,stroke-width:1px
        slangTXT[("slang.txt")]:::persistence
        historyTXT[("history.txt")]:::persistence
        mySlangTXT[("mySlang.txt")]:::persistence
    end

    %% Connections - Entry to UI
    Main -->|"launch()"| Home
    Home -->|"navigateToSearch()"| SearchPage
    Home -->|"navigateToManage()"| ManagePage
    Home -->|"navigateToGame()"| GamePage

    %% UI Navigation
    SearchPage -->|"openSlangSearch()"| SearchSlangPage
    SearchPage -->|"openDefinitionSearch()"| SearchDefinitionPage
    SearchPage -->|"openHistoryView()"| HistoryPage

    ManagePage -->|"openAdd()"| AddPage
    ManagePage -->|"openEdit()"| EditPage
    ManagePage -->|"openDelete()"| DeletePage

    GamePage -->|"startFindSlangQuiz()"| FindSlangPage
    GamePage -->|"startFindDefinitionQuiz()"| FindDefinitionPage

    %% UI to Model interactions
    SearchSlangPage -->|"searchBySlang()"| SlangWordList
    SearchDefinitionPage -->|"searchByDefinition()"| SlangWordList
    HistoryPage -->|"getHistory()"| HistorySearch

    AddPage -->|"addSlang()"| SlangWordList
    EditPage -->|"editSlang()"| SlangWordList
    DeletePage -->|"deleteSlang()"| SlangWordList

    FindSlangPage -->|"quizFindSlang()"| SlangWordList
    FindDefinitionPage -->|"quizFindDefinition()"| SlangWordList

    %% Model to FileManager
    SlangWordList -->|"loadAllSlangs()"| FileManager
    SlangWordList -->|"saveAllSlangs()"| FileManager
    HistorySearch -->|"appendHistory()"| FileManager

    %% FileManager to Data Files
    FileManager -->|"read/write"| slangTXT
    FileManager -->|"read/write"| historyTXT
    FileManager -->|"read/write"| mySlangTXT

    %% Utility Path
    ConsoleIO -.->|"testSearch()"| SlangWordList
    ConsoleIO -.->|"testHistory()"| HistorySearch
    ConsoleIO -.->|"fileOps()"| FileManager

    %% Click Events
    click Main "https://github.com/akiratomori/slang-word/blob/main/Main.java"
    click Home "https://github.com/akiratomori/slang-word/blob/main/source/Home.java"
    click FileManager "https://github.com/akiratomori/slang-word/blob/main/source/model/FileManager.java"
    click HistorySearch "https://github.com/akiratomori/slang-word/blob/main/source/model/HistorySearch.java"
    click SlangWord "https://github.com/akiratomori/slang-word/blob/main/source/model/SlangWord.java"
    click ListSlang "https://github.com/akiratomori/slang-word/blob/main/source/model/ListSlang.java"
    click SlangWordList "https://github.com/akiratomori/slang-word/blob/main/source/model/SlangWordList.java"
    click SearchPage "https://github.com/akiratomori/slang-word/blob/main/source/views/search/SearchPage.java"
    click SearchSlangPage "https://github.com/akiratomori/slang-word/blob/main/source/views/search/SearchSlangPage.java"
    click SearchDefinitionPage "https://github.com/akiratomori/slang-word/blob/main/source/views/search/SearchDefinitonPage.java"
    click HistoryPage "https://github.com/akiratomori/slang-word/blob/main/source/views/search/HistoryPage.java"
    click ManagePage "https://github.com/akiratomori/slang-word/blob/main/source/views/manage/ManagePage.java"
    click AddPage "https://github.com/akiratomori/slang-word/blob/main/source/views/manage/AddPage.java"
    click EditPage "https://github.com/akiratomori/slang-word/blob/main/source/views/manage/EditPage.java"
    click DeletePage "https://github.com/akiratomori/slang-word/blob/main/source/views/manage/DeletePage.java"
    click GamePage "https://github.com/akiratomori/slang-word/blob/main/source/views/game/GamePage.java"
    click FindSlangPage "https://github.com/akiratomori/slang-word/blob/main/source/views/game/FindSlangPage.java"
    click FindDefinitionPage "https://github.com/akiratomori/slang-word/blob/main/source/views/game/FindDefinitionPage.java"
    click ConsoleIO "https://github.com/akiratomori/slang-word/blob/main/source/util/ConsoleIO.java"

    %% Styles
    classDef view fill:#cce5ff,stroke:#004085,stroke-width:1px
    classDef model fill:#d4edda,stroke:#155724,stroke-width:1px
    classDef persistence fill:#e2e3e5,stroke:#6c757d,stroke-width:1px
    classDef util fill:#fff3cd,stroke:#856404,stroke-width:1px
    classDef entry fill:#f5c6cb,stroke:#721c24,stroke-width:1px
```
