# waterball-software-academy/software-design-pattern architecture

> Architecture diagram of the GitHub repository waterball-software-academy/software-design-pattern, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/waterball-software-academy/software-design-pattern
- Repository: https://github.com/waterball-software-academy/software-design-pattern

## Overview

##### Project Type Analysis
This is an educational codebase demonstrating various design patterns, organized into chapters (c1-c5) with practical examples.

##### Main Architectural Components
The system should be represented with these key components:

a. Core Pattern Categories (Top Level):
- Object-Oriented Programming (c1)
- Design Patterns (c2-c4)
- Lifecycle and IoC (c5)

b. Pattern Implementation Groups:
- Behavioral Patterns (Strategy, Template Method, Chain of Responsibility)
- Structural Patterns (Adapter, Facade, Decorator)
- Creational Patterns (Factory Method, Abstract Factory, Singleton)

##### Primary Layer (Pattern Categories)
**[Object-Oriented Programming] --- [Design Patterns] --- [Lifecycle & IoC]**

##### Secondary Layer (Pattern Groups)
**[Behavioral Patterns]**

**[Structural Patterns]**

**[Creational Patterns]**

##### Implementation Layer
- Concrete implementations with their relationships
- Example classes and their interactions

##### Key Relationships to Highlight

- Pattern Dependencies: Show how patterns interact (e.g., Factory Method creating Strategy objects)
- Implementation Hierarchy: Display inheritance and implementation relationships
- Utility Integration: Show how common utilities support pattern implementations

##### Implementation Details

For each pattern section, include:
- Pattern name and category
- Key participating classes
- Relationships between classes
- Example usage context

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main Categories
    OOP["Object-Oriented Programming"]:::oop
    DP["Design Patterns"]:::patterns
    LC["Lifecycle & IoC"]:::lifecycle

    %% Pattern Groups
    BP["Behavioral Patterns"]:::behavioral
    SP["Structural Patterns"]:::structural
    CP["Creational Patterns"]:::creational
    AP["Additional Patterns"]:::additional

    %% Behavioral Patterns
    Strategy["Strategy Pattern"]:::behavioral
    Template["Template Method"]:::behavioral
    Chain["Chain of Responsibility"]:::behavioral

    %% Structural Patterns
    Adapter["Adapter Pattern"]:::structural
    Facade["Facade Pattern"]:::structural
    Decorator["Decorator Pattern"]:::structural
    Composite["Composite Pattern"]:::structural

    %% Creational Patterns
    Factory["Factory Method"]:::creational
    AbstractFactory["Abstract Factory"]:::creational
    Singleton["Singleton Pattern"]:::creational

    %% Additional Patterns
    Command["Command Pattern"]:::additional
    State["State Pattern"]:::additional
    Observer["Observer Pattern"]:::additional

    %% Main Category Relationships
    OOP --- DP
    DP --- LC

    %% Pattern Group Relationships
    DP --> BP
    DP --> SP
    DP --> CP
    DP --> AP

    %% Behavioral Pattern Relationships
    BP --> Strategy
    BP --> Template
    BP --> Chain

    %% Structural Pattern Relationships
    SP --> Adapter
    SP --> Facade
    SP --> Decorator
    SP --> Composite

    %% Creational Pattern Relationships
    CP --> Factory
    CP --> AbstractFactory
    CP --> Singleton

    %% Additional Pattern Relationships
    AP --> Command
    AP --> State
    AP --> Observer

    %% Click Events
    click OOP "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c1-物件導向之不新手的新手村/"
    click Strategy "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c2-Christopher-Alexander-設計模式/景點-策略模式/"
    click Template "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c2-Christopher-Alexander-設計模式/景點-樣板方法/"
    click Chain "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c2-Christopher-Alexander-設計模式/景點-責任鏈模式/"
    click Adapter "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c4-規模化架構思維/景點-轉接器模式/"
    click Facade "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c4-規模化架構思維/景點-門面模式/"
    click Decorator "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c4-規模化架構思維/景點-裝飾者模式/"
    click Factory "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c5-生命週期及控制反轉/景點-工廠方法/"
    click AbstractFactory "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c5-生命週期及控制反轉/景點-抽象工廠/"
    click Singleton "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c5-生命週期及控制反轉/景點-單體模式/"
    click Command "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c3-掌握所有複雜行為變動/景點-指令模式/"
    click State "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c3-掌握所有複雜行為變動/景點-狀態模式/"
    click Observer "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c3-掌握所有複雜行為變動/景點-觀察者模式/"
    click Composite "https://github.com/Waterball-Software-Academy/Software-Design-Pattern/tree/master/c4-規模化架構思維/景點-複合模式/"

    %% Styles
    classDef oop fill:#f9f,stroke:#333,stroke-width:2px
    classDef patterns fill:#fcf,stroke:#333,stroke-width:2px
    classDef lifecycle fill:#fef,stroke:#333,stroke-width:2px
    classDef behavioral fill:#cef,stroke:#333,stroke-width:2px
    classDef structural fill:#cfc,stroke:#333,stroke-width:2px
    classDef creational fill:#fec,stroke:#333,stroke-width:2px
    classDef additional fill:#eee,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Main Categories]:::oop
        L2[Behavioral Patterns]:::behavioral
        L3[Structural Patterns]:::structural
        L4[Creational Patterns]:::creational
        L5[Additional Patterns]:::additional
    end
```
