Sub topic 13
Worked examples in writing, design, and software
This chapter applies the earlier ideas to three fields. It assumes you already know the four constraint types (resource, form, rule, time), the difference between productive and obstructive limits, and the basic loop of running an exercise and reviewing it. Each example below follows the same sequence: state the problem, pick a constraint, run it, review the result, and adjust.
The shared pattern
The three examples use one working model. An open problem has a large search space. A constraint removes a region of that space, and the remaining region is small enough to explore with some depth. The review step then asks whether the constraint helped or got in the way.
Example 1: Writing
The problem
You must write the opening paragraph of a product announcement. You have written three drafts, and all of them begin with "We are excited to announce." The blank-page problem has turned into a habit problem.
Choosing the constraint
The habit lives in the form of the text, so a form constraint fits. Two candidates:
- Write the paragraph in exactly 50 words.
- Write it without using the words "excited," "announce," "new," or "introducing."
The banned-words rule attacks the habit directly. The 50-word limit forces compression but does not stop the same opening from reappearing. Pick the banned-words rule and add a time limit of ten minutes.
Running it
Set a timer for ten minutes. Write as many openings as you can, and do not stop to polish. A typical result looks like this:
- "Last month, a customer told us she spent three hours a week copying numbers between two tabs."
- "Two tabs. One spreadsheet. Three hours every week."
- "Starting today, the copying stops."
Reviewing it
The first opening starts with a person rather than the company, which none of your earlier drafts did. The third is short and usable. The second is gimmicky but shows a rhythm you can borrow. The constraint did its job because it blocked the default route and the alternatives were each different from one another. A sign that a banned-word rule is obstructive: you spend most of the ten minutes hunting for synonyms of the banned words. If that happens, drop the list to one word.
Example 2: Design
The problem
You are designing the settings screen of a mobile app. It currently has 23 options, and the screen feels crowded. Every redesign so far has rearranged the same 23 options.
Choosing the constraint
The earlier redesigns kept an unstated assumption: all 23 options must be visible. A rule constraint can challenge that assumption. A resource constraint is also possible: the screen may show at most five items without scrolling. The two work well together, and the chapter on combining constraints suggests applying them in sequence rather than all at once.
Round one: show only five items. Round two: add the rule that every hidden option must be reachable in at most two taps.
Running it
Take five minutes for round one. Sketch on paper, not in a design tool, because paper adds its own resource limit and discourages pixel-level fiddling. You might produce:
- A screen with the five most-used options, plus a "More" row.
- A screen with search at the top and no list at all.
- A screen that groups options into three cards: Account, Notifications, Privacy.
Round two takes another five minutes. Check each sketch against the two-tap rule. The search-only screen fails if search needs a tap to open, but passes if the field is already focused.
Reviewing it
Count the options that were actually used in the last 90 days, if you have analytics. If only seven of the 23 options are used by most people, the five-item limit was close to the truth and the constraint was productive. If 18 are used regularly, the limit was obstructive and you should raise it to something like eight. The constraint is a way to test the assumption. It does not establish what the design should be.
Example 3: Software
The problem
A script that processes uploaded CSV files has grown into a 400-line function. You want to restructure it but have no clear starting point.
Choosing the constraint
A form constraint works well for code: no function may be longer than 15 lines. A rule constraint would be: no function may modify its arguments. Start with the form constraint, because it is mechanical to check.
Running it
The same pairing of problem and constraint can be generated automatically. The script below, from the earlier chapter on designing constraints, prints prompts for a session. Here the constraints are written for the refactoring task.
import random
def constrained_ideas(problem, constraints, count=3):
"""Pair a problem with randomly chosen constraints to prompt new ideas."""
picks = random.sample(constraints, k=min(count, len(constraints)))
return [f"{problem} -- but {c}" for c in picks]
constraints = [
"no function may be longer than 15 lines",
"no function may modify its arguments",
"every function must be testable without touching the disk",
"you may not use any new dependency",
]
for prompt in constrained_ideas("Restructure the CSV import script", constraints):
print(prompt)Then run a timed round with the second script, which enforces a time limit and an idea limit together. Use it to list the functions you would split out, one per line.
import time
def timed_brainstorm(prompt, seconds=300, max_ideas=10):
"""Collect ideas from the user until time or the idea limit runs out."""
print(prompt)
deadline = time.monotonic() + seconds
ideas = []
while time.monotonic() < deadline and len(ideas) < max_ideas:
idea = input(f"Idea {len(ideas) + 1}: ").strip()
if idea:
ideas.append(idea)
return ideas
if __name__ == "__main__":
ideas = timed_brainstorm(
"List functions to extract from the CSV import script "
"(each must be 15 lines or fewer):",
seconds=300,
max_ideas=8,
)
print(f"\nCollected {len(ideas)} ideas:")
for number, idea in enumerate(ideas, start=1):
print(f"{number}. {idea}")One limitation: input blocks, so the deadline is only checked after you press Enter. If you type nothing, the loop does not end when time runs out. For a practice tool this is acceptable, and the callout below explains the consequence.
A plausible list of extractions: read_rows, validate_row, normalize_dates, group_by_customer, write_report. Each is small by design.
Reviewing it
Apply the 15-line limit to your real code. Two outcomes are common:
- The limit exposes a function that does two jobs, and splitting it makes the code clearer. The constraint was productive.
- The limit forces you to split a tight loop into pieces that must pass five variables between them. The constraint was obstructive here. Relax it for that function and note why.
Comparing the three examples
| Field | Problem | Constraint type | What it removed | Sign it was obstructive |
|---|---|---|---|---|
| Writing | Repeated stock opening | Form (banned words) | The default phrasing | Time spent hunting synonyms |
| Design | Crowded settings screen | Resource and rule | The assumption that all options show | Five items hides options people use daily |
| Software | 400-line function | Form (line limit) | The habit of adding code to one place | Many arguments passed between tiny functions |
In all three cases the constraint targeted a specific default behavior. A constraint chosen without naming the default it should break tends to be arbitrary.
Common errors across fields
- Choosing a constraint before naming the habit or assumption it should break.
- Applying several constraints in the first round. Add one at a time so you can tell which one helped.
- Skipping the review. Without it you cannot tell a productive limit from an obstructive one.
- Treating a constraint as a requirement of the final product. In the design example, the five-item limit is a thinking tool and the shipped screen may differ.
- Keeping a constraint that failed. If the review shows it obstructed the work, loosen or drop it.
Try it yourself
Exercise
You are redesigning a weekly team status email that is always a long bulleted list nobody reads. Name the default behavior, choose a constraint type and a specific constraint, and give one sign during review that would tell you the constraint was obstructive.
Show answer
A sample answer. Default: every item gets reported, so the email grows without any selection. Constraint type: resource (or form). Constraint: the email may contain at most three items and no more than 60 words in total. Sign of an obstructive constraint: people start sending separate messages for the items that did not fit, or readers ask where an important update went. In that case raise the limit, for example to five items, or change the rule to "only items that need a decision." Other answers are fine if they name the default, match the type to it, and give a concrete review signal.
Exercise
In the software example, you apply the 15-line limit and one function needs six arguments passed between the small pieces. Is the constraint productive or obstructive for that function, and what would you do?
Show answer
It is obstructive for that function, because the split adds coupling and makes the code harder to read. Relax the limit for that function, record the reason, and consider whether the six values belong together in one object. Keep the limit for the rest of the script if it is helping there.