Skip to main content
Handbook/Read/Chapter 42 · Building Blocks

What Code Is Made Of

Share

Share this page

Pass it to someone who needs it.

Key takeaway: Name the pieces and code stops looking like noise

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:

class User { // class: a blueprint name = "Ada" // variable: one value greet() { // function: does one job return "Hi, " + this.name } } const ada = new User() // object: one real User export { User } // module: usable elsewhere

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.

A variable sits in a function, a function in a module, and modules 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.

Ready prompt
Act as a senior engineer reading a file beside me. Point at the file below and name each piece in it in plain words: every variable, function, class, and object, and where the module boundary is. For each, one short sentence: what it is and the job it does here. Do not assume I have read code before, and define any other term the first time it appears. The file:

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.

Mahmoud Zalt

Mahmoud Zalt

Software engineer, 16+ yrs · built Sistava.com in 3 months, idea to production, using these methods

Resources
Contribute
Donate

Support my work

A small tip keeps the free work coming.

© 2026 Mahmoud Zalt. Free to read, not to republish.
Copyright & license