# guilhermesob/java-advanced-topics architecture

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

- Interactive diagram: https://gitdiagram.com/guilhermesob/java-advanced-topics
- Repository: https://github.com/guilhermesob/java-advanced-topics

## Overview

##### Project type and purpose
- This is not a full‐stack app or microservice architecture. It’s an educational Java code repository containing sample programs that explore advanced Java backend topics (asynchronous programming, concurrent programming, Streams API, lambdas).
- Its “system” is really a set of example modules you compile and run on the JVM to demonstrate different features.

##### File structure
- Top level:
- Main.java – the entry point that can orchestrate or demonstrate the examples
- MultiThreadExample.java – specifically shows thread‐based concurrency and Futures
- README.md – describes topics (async, concurrency, Streams, lambdas)
- There’s no external configuration, no databases or web servers—just plain Java source.

##### README for additional insights
a. Asynchronous Programming (Futures, CompletableFuture)
b. Concurrent Programming (Thread, Runnable, ExecutorService)
c. Streams API (map, filter, reduce pipelines)
d. Lambda Functions (anonymous functions for brevity and readability)

##### Components
a. Main Components (rectangles):
1. Developer/Git Repo (source code host)
2. Build & Compile (javac or build tool)
3. Java Virtual Machine (JVM)
4. Example Modules (packages or classes):
– AsyncModule (Futures & CompletableFutures)
– ConcurrencyModule (Thread, Runnable, ExecutorService)
– StreamsModule (Stream pipeline)
– LambdaModule (functional interfaces)
5. OS / Thread Scheduler
– Developer → Git Repo (commit)
– Git Repo → Build & Compile (source checkout & compile)
– Build & Compile → JVM (class files loaded)
– JVM → Example Modules (calls Main → modules)
– Example Modules → OS / Thread Scheduler (spawning threads, scheduling tasks)
c. Architectural Patterns & Principles:
– Asynchronous callbacks vs. non‐blocking CompletableFuture pipelines
– Concurrent thread creation vs. managed ExecutorService
– Functional style data processing with Streams
– Use of lambdas to pass behavior as data
d. Key Technologies & Libraries:
– Java SE (javac, java)
– java.util.concurrent (Futures, CompletableFuture, ExecutorService)
– java.util.stream (Stream API)
– java.lang.Runnable, java.lang.Thread

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global entities
    Developer["Developer"]:::repo
    GitRepo["Git Repo / README.md"]:::repo
    Build["Build & Compile\n(javac / build tool)"]:::build
    JVM["JVM"]:::jvm

    subgraph "JVM Runtime"
        Main["Main.java"]:::codeModule
        Async["AsyncModule"]:::codeModule
        Concurrency["ConcurrencyModule"]:::codeModule
        Streams["StreamsModule"]:::codeModule
        Lambda["LambdaModule"]:::codeModule
    end

    Scheduler["OS / Thread Scheduler"]:::os

    %% Connections
    Developer -->|"commit"| GitRepo
    GitRepo -->|"checkout & compile"| Build
    Build -->|"load classes"| JVM
    JVM --> Main
    Main -->|"calls module"| Async
    Main -->|"calls module"| Concurrency
    Main -->|"calls module"| Streams
    Main -->|"calls module"| Lambda
    Async -->|"CompletableFuture tasks"| Scheduler
    Concurrency -->|"new Thread() / submit()"| Scheduler

    %% Streams internal pipeline
    source["Source"]:::codeModule
    mapfn["map()"]:::codeModule
    filterfn["filter()"]:::codeModule
    reducefn["reduce()"]:::codeModule
    Streams --> source --> mapfn --> filterfn --> reducefn

    %% Lambda interactions
    Lambda -->|"functional interface calls"| Main

    %% Click Events
    click Async "https://github.com/guilhermesob/java-advanced-topics/blob/main/Main.java"
    click Concurrency "https://github.com/guilhermesob/java-advanced-topics/blob/main/MultiThreadExample.java"
    click Streams "https://github.com/guilhermesob/java-advanced-topics/blob/main/Main.java"
    click Lambda "https://github.com/guilhermesob/java-advanced-topics/blob/main/Main.java"
    click GitRepo "https://github.com/guilhermesob/java-advanced-topics/blob/main/README.md"

    %% Styles
    classDef codeModule fill:#D0E8FF,stroke:#0366d6
    classDef build fill:#FFF4C1,stroke:#E0A800
    classDef jvm fill:#DFFFE0,stroke:#77B300
    classDef os fill:#E0E0E0,stroke:#A8A8A8
    classDef repo fill:#FFE0E0,stroke:#B33A3A
```
