Open a file your agent wrote and it looks like a wall of symbols. It is not. Code is built from a small set of pieces that repeat on every page, and you met a few of them while tracing a single path. This chapter puts them side by side and names the fifth that ties them together, so any file resolves into parts you recognize instead of noise.
4.4.1The five pieces you'll see everywhere
Five pieces make up almost everything in a code file:
- A variable is a named slot that holds one value.
- A function is a named block of steps you run by calling it.
- A class is a template for a kind of thing, say a
User. - An object is one concrete thing made from that template.
- A module is one file's code, packaged so other files can pull it in.
Here they are together, all five in a few lines:
Read the comments, not the syntax. You are spotting five shapes, not learning to type them.
4.4.2The pieces nest to make the app
These pieces are not a flat list, they nest inside each other. A variable lives in a function, a function lives in a module, and many modules together make the app.
That nesting is why "where does this live" always has an answer: every piece sits inside a bigger one, up to the whole app.
4.4.3The words you can leave to your agent
A few more words come up constantly. You only need to recognize them, the agent handles the rest:
- A type says what kind of value something is, a number, some text, a date, so whole classes of mistakes get caught before the app runs.
- An error (or exception) is the code's signal that a step failed, so the failure can be handled instead of silently ignored.
- async marks work that takes time, a network call or a database read, so the app keeps responding while it waits.
Each gets its due where it matters: errors run through the Debug part, and async comes up in Scale. Here, knowing the word is enough.
Do this now: open one file your agent wrote and paste the prompt, so the agent names each piece in it and the file resolves from a wall into parts you recognize.