# A deck in chapters

One file per chapter, ordered by file name.

**Spoken:**

> `demo/decks/` holds three files. The build joins them in name order, so the running order is visible in a directory listing.

---

## House rules

- Interrupt whenever something is unclear
- Slides and the handout go out afterwards
- Exercises are in pairs

**Spoken:**

> This slide lives in `demo/partials/house-rules.crv` and is pulled into every deck that needs it.

---

## Why chapters

- A commit touches one chapter, so the diff is readable
- Reordering is renaming
- A shared slide lives in one file and is included where it is needed

---

## Chapter two: reading code together

```php
foreach ($orders as $order) {
    $customer = $this->Customers->get($order->customer_id);
    $order->customer_name = $customer->name;
}

$orders = $this->Orders->find()
    ->contain(['Customers'])
    ->all();
```

One query per row above, one query below. The fence walks the audience through it.

---

### What it costs

| Rows | Queries before | Queries after |
| --- | --- | --- |
| 50 | 51 | 1 |
| 500 | 501 | 1 |
| 5000 | 5001 | 1 |

---

## Checkpoint

No query inside a loop.

---

## Chapter three: what the tooling gives you

- `reveal-carve lint` catches a mistyped directive before the room sees it
- `reveal-carve handout` turns this deck into a document with the spoken notes
- `reveal-carve watch` rebuilds and reloads while you write

---

## Thanks

Questions welcome afterwards too.

**Spoken:**

> The handout export includes exactly this note, which is the point: the document says what the slide left out.
