rewrite comments in neutral, terse style
Doc comments, inline comments, and README no longer editorialize about the code (ActiveRecord, leak, fake, Yak before/after). They now describe behavior only. Test A_client_can_reach_its_DbContext__the_leak renamed to A_client_can_reach_its_DbContext. No behavior changes; all 27 tests pass.
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
# AI Code Exploration Exercise
|
||||
|
||||
A small C# application in the Active Record style, for practicing using coding agents to explore unfamiliar codebases.
|
||||
A small C# application for practicing code exploration with a coding agent: use it to produce diagrams that reveal the structure and behavior of an unfamiliar codebase.
|
||||
|
||||
## What this is
|
||||
|
||||
The `src/Before/` folder contains a small domain model (Client, Order) backed by a fake EF Core `DbContext`. The `src/Before.Console/` project is a demo console app that seeds data and queries it.
|
||||
`src/Before/` contains a small domain model (Client, Order) with an in-memory `DbContext` and a `WebApp` consumer. `src/Before.Console/` is a demo console app that seeds data and queries it. `tests/Before.Tests/` covers the behavior.
|
||||
|
||||
**You do not need to read or understand the code before starting.** The point is to use a coding agent to produce diagrams that reveal the structure and behavior.
|
||||
**You do not need to read or understand the code before starting.** The point is to use a coding agent to produce the diagrams.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- A coding agent with access to this repo (Claude Code, Cursor, Copilot, etc.)
|
||||
- .NET SDK 10.0 (to build and run)
|
||||
- .NET SDK 10.0
|
||||
- `mmdc` CLI for Mermaid rendering, or IDE Mermaid preview
|
||||
|
||||
## Setup
|
||||
@@ -25,30 +25,29 @@ The `src/Before/` folder contains a small domain model (Client, Order) backed by
|
||||
|
||||
## Tasks
|
||||
|
||||
Use a coding agent to create diagrams of this codebase. Start broad, then iterate with follow-up prompts to refine.
|
||||
Start broad, then iterate with follow-up prompts to refine.
|
||||
|
||||
### Task 1: Class diagram (sanity check)
|
||||
### Task 1: Class diagram
|
||||
|
||||
Prompt your agent to create a **class diagram** of the classes in `src/Before/` using Mermaid. Iterate until you're satisfied it captures the structure accurately.
|
||||
Create a **class diagram** of the classes in `src/Before/` using Mermaid. Iterate until it captures the structure accurately.
|
||||
|
||||
**What to check:** Are the inheritance relationships correct? Are the associations (Client → Orders, Order → Client) visible? Is the DbContext leak (domain objects reaching persistence) shown?
|
||||
**What to check:** Are the inheritance relationships correct? Are the associations (Client → Orders, Order → Client) visible? Is the dependency between the domain classes and `DbContext` shown — and in which direction does it point?
|
||||
|
||||
### Task 2: Sequence diagram — happy path
|
||||
|
||||
Prompt your agent to create a **sequence diagram** for the flow when `Client.FindByName("Jane Doe")` is called.
|
||||
Create a **sequence diagram** for the flow when `Client.FindByName("Jane Doe")` is called.
|
||||
|
||||
### Task 3: Sequence diagram — exception path
|
||||
|
||||
Prompt your agent to create a **sequence diagram** for `Client.FindByNameRequired("Nobody")` — when the client is not found. What interactions differ from the happy path? Where is `ObjectNotFoundException` thrown?
|
||||
Create a **sequence diagram** for `Client.FindByNameRequired("Nobody")` — when the client is not found. What interactions differ from the happy path? Where is `ObjectNotFoundException` thrown?
|
||||
|
||||
### Task 4 (stretch): Full initialization flow
|
||||
|
||||
From `Program.cs` (the Console entry point), trace how the database gets initialized and what interactions happen on `Client` and `Order` entities. Include the exception flow from Task 3. This will be a larger diagram — iterate and simplify as needed.
|
||||
From `Program.cs` (the console entry point), trace how the `DbContext` is created and made available to entities, and what interactions happen on `Client` and `Order`. Include the exception flow from Task 3. This will be a larger diagram — iterate and simplify as needed.
|
||||
|
||||
## Tips
|
||||
|
||||
- **Start broad, then refine:** "Draw me a class diagram of src/Before/" is enough to start.
|
||||
- **Iterate on the prompt:** If the first diagram is missing something, ask the agent to add it. You don't need to write Mermaid syntax.
|
||||
- **Validate:** Use `mmdc` to check syntax, visually check the diagram against the code.
|
||||
- **The skill is directing the agent,** not writing diagrams by hand.
|
||||
|
||||
- **Direct the agent;** don't write diagrams by hand.
|
||||
|
||||
Reference in New Issue
Block a user