Lesson 3 of 5
Choose boundaries and dependencies by their consequences
The program in lesson 2 could have been written several other ways, and an agent asked to write it will pick one without saying so. This lesson takes three of its choices, where the functions are divided, how money is represented and what the program depends on, and compares each against a plausible alternative by what would follow from it. The point is not that the delivered choices are right in general; it is that each has consequences you can name, and naming them is how a non-programmer judges a design.
Numbered links identify sources. Underlined terms offer a definition without leaving the lesson.
A boundary is a place where responsibility changes hands
A in a program is a point where one part finishes its job and hands its result to another. In the quote comparison there are several: read_quotes turns a file into records; money and installed_price turn text into amounts; compare turns records into results and problems; format_table turns results into text; main connects them to the terminal. What crosses each boundary is named. Records cross the first, amounts the second, two lists the third, a string the fourth.
Compare that with an equally short program that does everything in one function: open the file, loop over the records, compute, print. It would produce the same table. The consequence shows up when you try to check it. To check the one-function version you have to run the whole program and read what it printed, which means every check also exercises formatting, and a change to the printed layout can break a check about arithmetic. Because compare returns its results as values rather than printing them, the checks in the next lesson ask about the numbers directly, and a change to the layout leaves them untouched.
The same boundary gives a second consequence: replaceability. If the committee wanted the comparison as a spreadsheet instead of a printed table, format_table could be replaced by a function that writes CSV, without reading or changing compare. A good boundary is one where you can say what crosses it and can imagine replacing either side. A boundary that is merely a file split, with the two halves reaching into each other's variables, has the cost of two files and neither benefit.
The idea is the same at larger scale. Anthropic's engineering write-up of harnesses for long-running application building separates planning, generating and evaluating into distinct agents and reports that a separate evaluator was easier to make skeptical than a generator was to make critical of its own work (harness design, March 2026). Those are boundaries between agents rather than between functions, and the report is about that team's experiments with the models of that time, but the reasoning is the one this section uses: a part you can check on its own, and remove on its own, is a part whose contribution you can know.
Representation: the same number, different consequences
money uses Decimal. The alternative is Python's ordinary floating-point number, float. For this file, all whole pounds, both give identical tables, so the choice looks like taste. It is not, and the way to see that is to state the consequence under a slightly different input.
Floating-point numbers store values in binary fractions, and most decimal fractions have no exact binary form. In Python, 0.1 + 0.2 evaluates to 0.30000000000000004, checked while writing this lesson. Decimal stores decimal digits, so Decimal("0.1") + Decimal("0.2") is exactly 0.3. Neither type has unlimited precision: Decimal works to a set number of significant digits, twenty-eight by default, and a division can still need rounding. What Decimal gives money is that amounts written in pounds and pence are stored as written and added as a person would add them.
Whether the difference matters depends on the criterion, not on the type. A total of 2150.0099999999998 and a total of 2150.01 round to the same pence, so a check that compares rounded amounts accepts both, while a check that compares the printed total accepts only one. Lesson 4 runs exactly that comparison on an authored float version of the program. The transferable habit is to ask, for any representation an agent chose, what input would make the alternatives disagree, whether that input is plausible in your data, and which criterion the committee actually holds.
Dependencies: code you did not write, running on your behalf
A is anything the program needs that its author did not write. Python itself is one; so are the csv, sys and decimal modules that ship with it, which are part of its . The delivered program has no dependency beyond that: no third-party package that must be downloaded and installed separately. An agent could instead have used a data-analysis package that reads the CSV into a table object, sorts it and prints it in a few lines.
The consequences of that choice are worth listing rather than assuming. The committee's laptop would need the package installed at a compatible version, and a future update to the package could change how it reads a quoted field or formats a number. Unless the author still validates each value explicitly, the package's defaults decide what a blank installation price or a "2,150" means, and those defaults are documented somewhere else. Against that stands real benefit: such packages handle many formats and large files, and for a program that grows they save a great deal of code. The right answer depends on who runs the program and what it will become, which is exactly why the choice should be made on purpose. The feature-spec procedure cited in lesson 1 puts this as a rule for its agent, no new dependency without the user's approval (SKILL.md); the rule is that course's, but the reason is general.
Andrew Ng made a related point about larger systems in August 2026: coding by request alone, without the fundamentals, means the agent silently picks your latency, consistency and cost tradeoffs (Intel, checked 2026-09-29). Those particular tradeoffs barely exist in a quote comparison that runs on one file. They appear as soon as the program keeps shared state or serves several people, for instance if the garden group wanted a shared booking sheet for its tool shed, where two members might book the same slot at the same moment. That extension is outside this module, and the reason it is outside is the lesson: each new boundary, stored state or dependency adds consequences that have to be stated before anyone can judge the design. A learner who can name the consequences of the three choices above is equipped to ask an agent to name the consequences of the ones it makes next.
Carry this forward
- A boundary is where one part hands its result to another; judge it by whether you can say what crosses it and can check or replace either side alone.
- Because
comparereturns values rather than printing them, its arithmetic can be checked directly, and a change to the printed layout does not touch those checks. - For any representation an agent chose, ask what input would make the alternatives disagree, whether it is plausible in your data, and which criterion the committee holds;
Decimalandfloatdiffer on some pence totals before rounding. - A dependency is anything the program needs that its author did not write, including the language and its standard library; a third-party package brings its own defaults and updates, so add one on purpose with the consequences listed.
- Tradeoffs an agent makes silently, such as consistency and cost, grow with shared state and multiple users; a state-free program keeps them small, which is a reason to keep it that way until the specification says otherwise.
Lesson check
Choose an answer for each question.
This is a practice check. Answers reset when you leave this page. Results are not saved and do not place you in another module or award a qualification.
Design consequences are predictions. The next lesson makes them observable: a check that fails on a flawed version of the program, for the intended reason, and passes once the flaw is fixed.
Sources · Reviewed 2026-09-29
- 4. Prithvi Rajasekaran (Anthropic engineering): Harness design for long-running application development (March 2026)
- 2. DeepLearning.AI, Spec-Driven Development course files: feature-spec skill (SKILL.md)
- 7. VibeLeaderboard Intel: Andrew Ng on vibe coding without fundamentals (August 2026)
Sources support nearby explanations. Product details can change. Scenarios and model results are authored illustrations unless a lesson explicitly identifies a recorded execution. Module 7 identifies its offline code checks.