Chapter 14. Structuring Programs in the AI Era: Objects, Data and Async
In this section
- Chapter 14. Structuring Programs in the AI Era: Objects, Data and AsyncRead and review the structured code agents and SDKs produce, in TypeScript and Python: modules, types you write down, classes and objects, schemas, errors as design, JSON and REST APIs, async and await, and SDK-shaped code.
- 14.1 From scripts to programs: modulesHow to find your way around a repository an agent split into modules, by what each file imports, and what to check before it adds a package.
- 14.2 Types you write downHow to write down which values your data may hold, and where text from outside becomes one of those types.
- 14.3 Classes and objectsHow to read a class by the data it holds and the job of each method, when to hold another object instead of extending it, and how TypeScript and Python decide that two objects are equal.
- 14.4 Data models and schemasHow a schema checks every record at the edge of a program, what it cannot check, and how it becomes JSON Schema.
- 14.5 Errors as designWhat a program should do when its edge refuses data: when to stop, why to collect every bad row, and what the report tells the person who owns the data.
- 14.6 JSON and REST APIsHow to read a request to another program's API and the JSON that comes back, act on each status code on purpose, fetch every page and keep the key out of the code.
- 14.7 Async and awaitWhen slow calls can run at the same time, which failures are worth one more try, and why every call needs a time limit.
- 14.8 Reading SDK-shaped codeHow to recognize the shapes in the code a company publishes for its service, and find what that code checks for you and what it leaves to you.
- 14.9 How today's tools realize itWhere Claude Code, Codex and OpenCode differ when they install a package, reach a server on your own computer, keep it running and review a change, as their own pages said on October 30, 2026.
- Lab 14: models and an async client in two languagesChapter 14's lab: Invoice and Vendor schemas, a loader that reports every bad row and an async client for a local sample AP API, in TypeScript and in Python with tests first, then one change ported to one or two more agents.
- Check yourselfRecall and practice for the whole chapter: the flashcards, and a final quiz round from all nine concepts.