# frereriku/dependency-injection-with-quicklewiper architecture

> Architecture diagram of the GitHub repository frereriku/dependency-injection-with-quicklewiper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/frereriku/dependency-injection-with-quicklewiper
- Repository: https://github.com/frereriku/dependency-injection-with-quicklewiper

## Overview

1. This repository is a tiny Java console demo focused on Dependency Injection (DI), using a “Quickle Wiper” cleaning tool as the domain model. Its purpose is educational: show how a main object can be kept independent from interchangeable parts.

2. The code is split into two clear subsystems:
   - `cleaningdidemo.core`: the reusable “device” side
   - `cleaningdidemo.sheets`: the interchangeable “attachment” side  
   This is the key architectural boundary in the repo.

3. `cleaningdidemo.Main` is the entry point. It is responsible for wiring the objects together and starting the demo. In DI terms, this is where the object graph is assembled rather than hidden inside the core classes.

4. `cleaningdidemo.core.QuickleWiper` is the central domain object. It represents the wiper body itself and depends on a sheet/cloth abstraction or sheet-like object rather than a specific concrete implementation. That separation is the main design lesson of the repository.

5. The `cleaningdidemo.sheets` package contains the replaceable implementations of the wiping surface:
   - `CleaningSheet`
   - `CheapSheet`
   - `DustCloth`
   - `GenuineSheet`  
   These classes represent different variants that can be swapped without changing the `QuickleWiper` class.

6. The main data flow is simple:
   - `Main` chooses a sheet implementation
   - `Main` passes it into `QuickleWiper`
   - `QuickleWiper` uses that injected dependency to perform its cleaning behavior  
   This demonstrates constructor-style or explicit object injection at the composition boundary.

7. The architecture is intentionally layered but not framework-driven. There is no web layer, persistence layer, or external service integration. The entire repo is a small, in-memory object model meant to isolate the DI concept as clearly as possible.

8. The package names suggest a clean dependency direction:
   - `Main` depends on both `core` and `sheets`
   - `core` should depend on an abstraction or minimal contract, not on a specific sheet class
   - `sheets` are leaf implementations and should not depend on `core`  
   This one-way dependency structure is what makes substitution possible.

9. The repository is likely designed to show the difference between coupling to a concrete class versus depending on a swappable part. The presence of multiple sheet classes implies that the same `QuickleWiper` behavior can be reused with different consumables.

10. Tooling/runtime is minimal:
   - Java 17
   - Compile with `javac cleaningdidemo/Main.java`
   - Run with `java cleaningdidemo.Main`  
   There is no build system metadata in the tree, so the architecture is deliberately lightweight and self-contained.

11. For an architecture diagram, the most important boxes are:
   - `Main` as composition root
   - `QuickleWiper` as the core consumer
   - the four sheet classes as interchangeable implementations  
   The main arrow should show dependency injection from `Main` into `QuickleWiper`.

12. The overall design goal is not business functionality but demonstrability: show how a core class stays stable while variants are swapped at construction time. That is the central architectural idea of the repo.

Main entry points: [`cleaningdidemo/Main.java`](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/Main.java) (Main), [`cleaningdidemo/core/QuickleWiper.java`](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/core/QuickleWiper.java) (QuickleWiper), [`cleaningdidemo/sheets/CleaningSheet.java`](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/CleaningSheet.java) (CleaningSheet), [`cleaningdidemo/sheets/CheapSheet.java`](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/CheapSheet.java) (CheapSheet)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["core"]
  node_wiper["QuickleWiper<br/>core consumer<br/>[QuickleWiper.java]"]
  node_sheet_contract(("Sheet contract<br/>abstraction"))
end

subgraph group_sheets["sheets"]
  node_cleaning_sheet["CleaningSheet<br/>sheet impl<br/>[CleaningSheet.java]"]
  node_cheap_sheet["CheapSheet<br/>sheet impl<br/>[CheapSheet.java]"]
  node_dust_cloth["DustCloth<br/>sheet impl<br/>[DustCloth.java]"]
  node_genuine_sheet["GenuineSheet<br/>sheet impl<br/>[GenuineSheet.java]"]
end

node_main["Main<br/>composition root<br/>[Main.java]"]

node_main -->|"creates"| node_wiper
node_main -->|"selects"| node_cleaning_sheet
node_main -->|"selects"| node_cheap_sheet
node_main -->|"selects"| node_dust_cloth
node_main -->|"selects"| node_genuine_sheet
node_wiper -->|"depends on"| node_sheet_contract
node_cleaning_sheet -.->|"implements"| node_sheet_contract
node_cheap_sheet -.->|"implements"| node_sheet_contract
node_dust_cloth -.->|"implements"| node_sheet_contract
node_genuine_sheet -.->|"implements"| node_sheet_contract

click node_main "https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/Main.java"
click node_wiper "https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/core/QuickleWiper.java"
click node_cleaning_sheet "https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/CleaningSheet.java"
click node_cheap_sheet "https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/CheapSheet.java"
click node_dust_cloth "https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/DustCloth.java"
click node_genuine_sheet "https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/GenuineSheet.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wiper,node_sheet_contract toneBlue
class node_cleaning_sheet,node_cheap_sheet,node_dust_cloth,node_genuine_sheet toneAmber
class node_main toneNeutral
```

## Components

### core

Reusable device logic

- [QuickleWiper](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/core/QuickleWiper.java): core consumer · Central wiper body that uses an injected sheet-like dependency · `cleaningdidemo/core/QuickleWiper.java`
- **Sheet contract**: abstraction · Minimal contract consumed by the wiper

### sheets

Interchangeable wiping surfaces

- [CleaningSheet](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/CleaningSheet.java): sheet impl · One interchangeable wiping surface · `cleaningdidemo/sheets/CleaningSheet.java`
- [CheapSheet](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/CheapSheet.java): sheet impl · Low-cost sheet variant · `cleaningdidemo/sheets/CheapSheet.java`
- [DustCloth](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/DustCloth.java): sheet impl · Cloth-based sheet variant · `cleaningdidemo/sheets/DustCloth.java`
- [GenuineSheet](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/sheets/GenuineSheet.java): sheet impl · Higher-quality sheet variant · `cleaningdidemo/sheets/GenuineSheet.java`

### Other components

- [Main](https://github.com/frereriku/dependency-injection-with-quicklewiper/blob/main/cleaningdidemo/Main.java): composition root · Wires the demo object graph and starts execution · `cleaningdidemo/Main.java`

## Connections

- Main → QuickleWiper: creates · Composition root assembles the core object
- Main → CleaningSheet: selects · Chooses one concrete sheet at startup
- Main → CheapSheet: selects · Chooses one concrete sheet at startup
- Main → DustCloth: selects · Chooses one concrete sheet at startup
- Main → GenuineSheet: selects · Chooses one concrete sheet at startup
- QuickleWiper → Sheet contract: depends on · Core logic uses the abstraction rather than a specific class
- CleaningSheet → Sheet contract: implements · Concrete sheet variant
- CheapSheet → Sheet contract: implements · Concrete sheet variant
- DustCloth → Sheet contract: implements · Concrete sheet variant
- GenuineSheet → Sheet contract: implements · Concrete sheet variant
