# vishalla/oops-assingment-1 architecture

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

- Interactive diagram: https://gitdiagram.com/vishalla/oops-assingment-1
- Repository: https://github.com/vishalla/oops-assingment-1

## Overview

##### Project type and purpose
- This is a standalone, Java-based, command-line quiz training application.
- Purpose: Load a text file of questions (TF, MC, SA), prompt a player for answers, track score, and display results.

##### File structure
- Top-level:
- src/ – contains all Java classes
- Player.java – stores player’s name and score
- Question.java – abstract base class
- QuestionTF.java, QuestionMC.java, QuestionSA.java – concrete subclasses
- QuizBowl.java – main driver, orchestrates I/O, parsing, game loop
- No external services or databases—only file I/O and console I/O
- Build script is implicit (javac), run command is java QuizBowl

##### README for additional insights
- Describes question file format and program flow
- Emphasizes three question types and a simple CLI interface
- No mention of GUI/web/etc., confirming a single-process, CLI architecture

##### Main components and interactions
a. Components
1. External File System
- “Question File” (sample.txt or user-provided)
2. CLI I/O Layer
- Standard Input (stdin), Standard Output (stdout)
3. Controller / Engine
- QuizBowl (main class)
4. Domain Model
- Player
- Question (abstract)
- QuestionTF, QuestionMC, QuestionSA
5. Parser / Factory
- Logic inside QuizBowl that reads lines, creates correct Question subclass
b. Relationships & Data Flow
- On startup, QuizBowl reads filename from CLI
- QuizBowl invokes FileReader → Parser → produces List<Question>
- For each Question in list:
- QuizBowl calls question.ask() (polymorphic dispatch)
- Reads answer from CLI, routes to question.evaluate(), updates Player.score
- At end, QuizBowl prints Player.score to CLI
c. Architectural patterns & principles
- OOP & Inheritance (Question base class, subtype polymorphism)
- Single Responsibility:
- Question subclasses handle their own parsing and evaluation
- Player tracks identity & score
- QuizBowl orchestrates flow & I/O
d. Key technologies & libraries
- Java SE (java.io for FileReader/BufferedReader, java.util for collections)
- No frameworks; direct console I/O

##### Step-by-step creation
2. “Parser / Factory” connecting to a cluster of Question subclasses (inheritance tree under abstract Question).
- Association to Player (1)
- Loops over Questions (n)
5. End of flow: QuizBowl → CLI “Display final score.”

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Layer
    subgraph "External Layer"
        File["Question File"]:::external
    end

    %% Parser / Factory Layer
    subgraph "Parser / Factory"
        Parser["Parser / Factory"]:::engine
    end

    %% Model Layer
    subgraph "Model Layer"
        QuestionBase["Question (abstract)"]:::model
        QuestionTF["QuestionTF"]:::model
        QuestionMC["QuestionMC"]:::model
        QuestionSA["QuestionSA"]:::model
        Player["Player"]:::model
    end

    %% Engine Layer
    subgraph "Engine Layer"
        QuizBowl["QuizBowl"]:::engine
    end

    %% CLI I/O Layer
    subgraph "CLI I/O Layer"
        CLI["CLI I/O"]:::external
    end

    %% Inheritance Relationships
    QuestionBase -->|"extends"| QuestionTF
    QuestionBase -->|"extends"| QuestionMC
    QuestionBase -->|"extends"| QuestionSA

    %% Data Flow
    File -->|reads| Parser
    Parser -->|creates List<Question>| QuizBowl
    QuizBowl -->|has| Player
    QuizBowl -->|loops 1..*| QuestionBase
    QuizBowl -->|prompts/reads| CLI
    CLI -->|input/output| QuizBowl
    QuizBowl -->|displays score| CLI

    %% Click Events
    click File "https://github.com/vishalla/oops-assingment-1/blob/main/q.txt"
    click Parser "https://github.com/vishalla/oops-assingment-1/blob/main/src/Quize_Bowl.java"
    click QuizBowl "https://github.com/vishalla/oops-assingment-1/blob/main/src/Quize_Bowl.java"
    click CLI "https://github.com/vishalla/oops-assingment-1/blob/main/src/Quize_Bowl.java"
    click Player "https://github.com/vishalla/oops-assingment-1/blob/main/src/Player.java"
    click QuestionBase "https://github.com/vishalla/oops-assingment-1/blob/main/src/Question.java"
    click QuestionTF "https://github.com/vishalla/oops-assingment-1/blob/main/src/QuestionTF.java"
    click QuestionMC "https://github.com/vishalla/oops-assingment-1/blob/main/src/QuestionMC.java"
    click QuestionSA "https://github.com/vishalla/oops-assingment-1/blob/main/src/QuestionSA.java"

    %% Styles
    classDef external fill:#ddd,stroke:#000,color:#000;
    classDef engine fill:#d0f0c0,stroke:#070,color:#000;
    classDef model fill:#add8e6,stroke:#000,color:#000;
```
