# prmr/designbook architecture

> Architecture diagram of the GitHub repository prmr/designbook, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prmr/designbook
- Repository: https://github.com/prmr/designbook

## Overview

This repository is an educational companion to *Introduction to Software Design with Java*, not a single runtime application. Its main user workflow is for a learner to consult the book’s commented code samples, organized by chapter and edition; selected exercise solutions are a separate resource. The README documents these repository-level offerings. The supplied source excerpts show specific deck, card, observer, command, and strategy examples, but do not establish calls between most chapter samples, so the graph avoids implying a cross-chapter execution flow.

Main entry points: [`code-e1/e1/chapter9/CommandClient.java`](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/CommandClient.java) (Command client), [`code-e1/e1/chapter9/StrategyClient.java`](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/StrategyClient.java) (Strategy client), [`code-e1`](https://github.com/prmr/designbook/tree/master/code-e1) (First edition samples), [`code-e2`](https://github.com/prmr/designbook/tree/master/code-e2) (Second edition samples)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editions["Book editions"]
  node_e1samples["First edition samples"]
  node_e2samples["Second edition samples"]
  node_e3samples["Third edition samples"]
end

subgraph group_examples["Sample components"]
  node_e1deck["Deck and shuffler<br/>[Deck.java]"]
  node_e1cards["Flyweight cards<br/>[Card.java]"]
  node_e1rank["Card rank<br/>[Rank.java]"]
  node_e1suit["Card suit<br/>[Suit.java]"]
  node_e1inventory["Card inventory<br/>[Inventory.java]"]
  node_e1lucky["Visitor examples<br/>[LuckyNumber.java]"]
  node_e1selection["Card selection<br/>[CardSelection.java]"]
  node_e1command["Deck commands<br/>[DeckCommand.java]"]
  node_e1client["Command client<br/>[CommandClient.java]"]
  node_e1strategyclient["Strategy client"]
end

subgraph group_solutions["Exercise solutions"]
  node_observabledeck["Observable deck examples"]
  node_moviesolutions["Movie solutions<br/>[Movies.java]"]
end

node_learner(("Learner"))

node_learner -->|"consults"| node_e1samples
node_learner -->|"consults"| node_e2samples
node_learner -->|"consults"| node_e3samples
node_learner -->|"studies solutions"| node_observabledeck
node_learner -->|"studies solutions"| node_moviesolutions
node_e1client -->|"uses"| node_e1deck
node_e1client -.->|"compares decks"| node_e1cards
node_e1client -->|"creates"| node_e1command
node_e1strategyclient -->|"selects strategy"| node_e1selection

click node_e1samples "https://github.com/prmr/designbook/tree/master/code-e1"
click node_e2samples "https://github.com/prmr/designbook/tree/master/code-e2"
click node_e3samples "https://github.com/prmr/designbook/tree/master/code-e3"
click node_e1deck "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter4/Deck.java"
click node_e1cards "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Card.java"
click node_e1rank "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Rank.java"
click node_e1suit "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Suit.java"
click node_e1inventory "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Inventory.java"
click node_e1lucky "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/LuckyNumber.java"
click node_e1selection "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/CardSelection.java"
click node_e1command "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/DeckCommand.java"
click node_e1client "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/CommandClient.java"
click node_e1strategyclient "https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/StrategyClient.java"
click node_observabledeck "https://github.com/prmr/designbook/blob/master/solutions-code/chapter8/ObservableDeck1.java"
click node_moviesolutions "https://github.com/prmr/designbook/blob/master/solutions-code/chapter9/Movies.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_e1samples,node_e2samples,node_e3samples toneBlue
class node_e1deck,node_e1cards,node_e1rank,node_e1suit,node_e1inventory,node_e1lucky,node_e1selection,node_e1command,node_e1client,node_e1strategyclient toneAmber
class node_observabledeck,node_moviesolutions toneMint
class node_learner toneIndigo
```

## Components

### Book editions

- [First edition samples](https://github.com/prmr/designbook/tree/master/code-e1): `code-e1`
- [Second edition samples](https://github.com/prmr/designbook/tree/master/code-e2): `code-e2`
- [Third edition samples](https://github.com/prmr/designbook/tree/master/code-e3): `code-e3`

### Sample components

- [Deck and shuffler](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter4/Deck.java): `code-e1/e1/chapter4/Deck.java`
- [Flyweight cards](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Card.java): `code-e1/e1/chapter8/Card.java`
- [Card rank](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Rank.java): `code-e1/e1/chapter8/Rank.java`
- [Card suit](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Suit.java): `code-e1/e1/chapter8/Suit.java`
- [Card inventory](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/Inventory.java): `code-e1/e1/chapter8/Inventory.java`
- [Visitor examples](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter8/LuckyNumber.java): `code-e1/e1/chapter8/LuckyNumber.java`
- [Card selection](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/CardSelection.java): `code-e1/e1/chapter9/CardSelection.java`
- [Deck commands](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/DeckCommand.java): `code-e1/e1/chapter9/DeckCommand.java`
- [Command client](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/CommandClient.java): `code-e1/e1/chapter9/CommandClient.java`
- [Strategy client](https://github.com/prmr/designbook/blob/master/code-e1/e1/chapter9/StrategyClient.java): `code-e1/e1/chapter9/StrategyClient.java`

### Exercise solutions

- [Observable deck examples](https://github.com/prmr/designbook/blob/master/solutions-code/chapter8/ObservableDeck1.java): `solutions-code/chapter8/ObservableDeck1.java`
- [Movie solutions](https://github.com/prmr/designbook/blob/master/solutions-code/chapter9/Movies.java): `solutions-code/chapter9/Movies.java`

### Other components

- **Learner**

## Connections

- Learner → First edition samples: consults (evidence: `README.md`)
- Learner → Second edition samples: consults (evidence: `README.md`)
- Learner → Third edition samples: consults (evidence: `README.md`)
- Learner → Observable deck examples: studies solutions (evidence: `README.md`)
- Learner → Movie solutions: studies solutions (evidence: `README.md`)
- Command client → Deck and shuffler: uses
- Command client → Flyweight cards: compares decks
- Command client → Deck commands: creates (evidence: `code-e1/e1/chapter9/CommandClient.java`)
- Strategy client → Card selection: selects strategy (evidence: `code-e1/e1/chapter9/StrategyClient.java`)
