Chapter 01 / 15 · Webster International
The Engineering Mindset
What engineering solves, how to choose designs, and why events, jobs, boundaries and trade-offs exist.
Start with the questions that shape every project: who needs this, what changes, what can fail, and how will anyone know it works?
01 / FIELD NOTE
Engineering is the management of trade-offs
Mental model: Think of each design as a constrained purchase: engineering time buys user outcomes, reliability and ease of change. Specify a measurable user journey, acceptable failure rate, accessibility criteria and operating cost before selecting technology. Compare options against hard constraints rather than averaging away security. Debug the decision by checking real task completion, latency distribution and error budgets; a fast API can still hide an unusable form.
A trade-off is meaningful only when the user benefit and the sacrificed quality are both explicit.
Scenario A: a dog-walking CRM favors durable route-order saving over animations, with keyboard reordering tested. Scenario B: a concert importer accepts five-minute freshness to avoid brittle scraping, but measures missing and duplicate events.
const total=10000,good=9987,target=.999;
const allowed=Math.round(total*(1-target));
const failed=total-good;
console.log({allowed,failed,passes:good/total>=target});
if(allowed!==10||failed!==13)throw Error('Math failed');Hands-on exercise · reveal the verification check
Calculate the failure budget for 10,000 requests at 99.9%; add a keyboard-only and slow-network acceptance test.
Ten failures are allowed, thirteen exceed the budget by three; HTTP 200 alone does not prove a successful user task.
02 / FIELD NOTE
Model the domain before building screens
Mental model: A domain model is a set of named facts, actors, permitted transitions and invariants; screens are projections of it. Define who can change requested→confirmed→completed, which transitions are forbidden, and how concurrent changes resolve. Debug by replaying the first invalid transition, not by inspecting only the last button click. Validate permissions on the server and enforce database constraints.
Shared business states keep UI, invoicing, reporting and automation from disagreeing about what actually happened.
Scenario A: a dog walk cannot be cancelled by an ordinary user after completion. Scenario B: a venue inquiry may be accepted only by its venue owner; both display clear, accessible state and error feedback.
const allowed={requested:['confirmed','cancelled'],confirmed:['completed','cancelled'],completed:[],cancelled:[]};
function move(from,to,role){if(role!=='owner'||!allowed[from]?.includes(to))throw Error('Invalid');return to;}
console.log(move('requested','confirmed','owner'));
try{move('completed','requested','owner');throw Error('Accepted invalid');}catch(e){if(e.message==='Accepted invalid')throw e;}Hands-on exercise · reveal the verification check
Test requested→confirmed, completed→requested, unauthorized confirmation and simultaneous completion/cancellation.
Only the first transition succeeds; concurrent requests cannot silently overwrite one another.
03 / FIELD NOTE
Separate responsibilities with boundaries
Mental model: A boundary isolates a reason to change: UI owns interaction, domain owns rules, persistence owns facts and adapters own external vendors. Dependencies point toward the domain, even inside one deployable app. Trace failures through input, rule, storage and side effect. Use narrow explicit contracts and errors; an interface is justified by real variation or a useful test seam.
Changing a CRM theme or a third-party provider should not silently rewrite booking authorization or business invariants.
Scenario A: a reservation use case receives a repository, while a form supplies labeled validation errors. Scenario B: two concert feed formats normalize through adapters before entering one event model.
function reserve(repo,input){if(!input.clientId||input.minutes<=0)throw Error('Invalid');return repo.save(input);}
const rows=[];const repo={save:x=>{rows.push(x);return {id:'b1',...x};}};
const result=reserve(repo,{clientId:'c1',minutes:30});
if(rows.length!==1||result.id!=='b1')throw Error('Boundary failed');
console.log(result);Hands-on exercise · reveal the verification check
Replace a real persistence adapter with a fake for a domain unit test, then verify the same rule against a test database.
Both adapters accept/reject the same domain inputs; real database behavior is separately integration-tested.
04 / FIELD NOTE
Synchronous requests versus asynchronous work
Mental model: Synchronous work makes a caller wait for a result; asynchronous work records intent and exposes a separately observable job lifecycle. HTTP 202 means accepted, not completed or guaranteed. Persist a job ID, queued/running/succeeded/failed states, retry policy and status URL. Debug by following the ID through enqueue, worker, storage and notification. Announce progress accessibly and bound polling.
Long-running exports and image rendering must not block HTTP until timeout or display a false success message.
Scenario A: CRM invoice export returns a job ID and later a downloadable file. Scenario B: local-news imports show last successful refresh separately from queued refreshes.
const jobs=new Map();
function accept(id){if(!jobs.has(id))jobs.set(id,{id,state:'queued'});return jobs.get(id);}
function finish(id){const j=jobs.get(id);if(!j||j.state!=='queued')throw Error('Bad state');j.state='succeeded';}
accept('export-1');finish('export-1');
if(accept('export-1').state!=='succeeded')throw Error('Lost state');
console.log(jobs.get('export-1')); // illustrative, not durableHands-on exercise · reveal the verification check
Design POST /exports and GET /exports/{id}; test queued, failed, succeeded, crash/retry and foreign-user access.
POST returns 202 and a stable status URL; only durable success is complete; unauthorized lookup is denied.
05 / FIELD NOTE
Event-driven versus scheduled jobs
Mental model: Events describe facts that happened; scheduled jobs inspect what needs attention on a clock. Event delivery may duplicate, delay or fail. Use stable event IDs, durable consumer deduplication and a transactional outbox when message publication must follow a committed change. Reconciliation scans repair missed effects. Debug with event ID, publish attempt, consumer receipt and persisted effect.
An event can update an invoice promptly while a daily scan detects missing work without duplicating it.
Scenario A: WalkCompleted creates one invoice despite a duplicate delivery; nightly reconciliation finds missed invoices. Scenario B: VenueEventCancelled updates the calendar promptly, then a daily scan checks cancellations.
const seen=new Set(),invoices=[];
function onEvent(e){if(seen.has(e.id))return; if(e.type!=='WalkCompleted')throw Error('Type');seen.add(e.id);invoices.push(e.walkId);}
const e={id:'evt-9',type:'WalkCompleted',walkId:'w2'};
onEvent(e);onEvent(e);
if(invoices.length!==1)throw Error('Duplicate');
console.log(invoices); // use transactional dedupe in productionHands-on exercise · reveal the verification check
Deliver an event twice, crash before acknowledgement, and design a daily reconciliation query.
One invoice per event ID; transactional dedupe survives crash and scan finds missing invoices.
06 / FIELD NOTE
State, side effects and invariants
Mental model: State is remembered truth; a side effect changes another system; an invariant must hold after every concurrent operation. Read-then-write in application code is not atomic. Use a guarded database UPDATE inside a transaction and inspect RETURNING rows; commit before notifications. Debug overselling with simultaneous requests, lock waits and constraints. A disabled button is not a concurrency control.
Correctness must survive retries, multiple browser tabs and independent workers competing for the last available slot.
Scenario A: two dog-walk clients compete for one remaining group slot. Scenario B: two buyers request the last concert ticket; one gets a recoverable, accessible conflict response.
-- PostgreSQL illustrative SQL: run only against a disposable walks table
BEGIN;
UPDATE walks SET available=available-1
WHERE id=42 AND available>0
RETURNING id,available;
-- Zero rows means no slot; otherwise reserve the booking in this transaction.
COMMIT;Hands-on exercise · reveal the verification check
Initialize one slot; run two simultaneous guarded UPDATEs and a request from an unauthorized tenant.
Exactly one UPDATE returns a row, available never becomes negative, and unauthorized writes are rejected.
07 / FIELD NOTE
Define what done means
Mental model: Planned, coded, tested, deployed and verified are separate evidence states. A commit SHA identifies source; CI verifies specific checks; deployment identifies an artifact/environment; browser probes establish that users can complete the journey. Debug missing features by comparing reviewed SHA, deployed SHA, HTTP asset status, browser console and persistence. Zero-step CI is not a test pass.
Evidence-based status prevents draft PRs or cached broken assets from being represented as live customer functionality.
Scenario A: a CRM page returns 200 but a data module is missing from the Docker image. Scenario B: guide syntax checks pass but no keyboard or screen-reader test has run; neither is fully verified.
function live(e){return e.merged&&e.ci&&e.sha===e.deployed&&e.http&&e.browser&&e.a11y;}
const e={merged:true,ci:true,sha:'new',deployed:'old',http:true,browser:false,a11y:false};
if(live(e))throw Error('False publication');
e.deployed='new';e.browser=true;e.a11y=true;
console.log(live(e));Hands-on exercise · reveal the verification check
Create a release evidence table with commit, CI, deployment SHA, HTTP modules, keyboard and screen-reader checks.
A stale SHA, missing asset, unrun browser check or unmerged PR always blocks a live claim.
08 / FIELD NOTE
Prefer the simplest reversible design
Mental model: Choose the smallest design that preserves a safe path to change. A modular monolith can provide strong boundaries without network hops. Write an ADR with context, alternatives, decision, consequences and a measurable revisit trigger. Debug architecture using change lead time, incidents and ownership friction, not service count. Add an adapter or migration seam before adding a new deployment.
Every service adds security, monitoring, versioning, network failure and on-call obligations; reversible choices reduce premature cost.
Scenario A: a musician directory stays one application until search measurements justify a separate index. Scenario B: a dog-walking CRM keeps billing and scheduling together until team ownership or measured scale requires extraction.
const adr={context:'Single-team CRM',options:['monolith','services'],decision:'monolith',consequence:'Simple deploy',revisitWhen:'Measured scaling limit'};
for(const k of ['context','options','decision','consequence','revisitWhen'])if(!adr[k])throw Error('Missing '+k);
console.log(adr.decision);Hands-on exercise · reveal the verification check
Write an ADR comparing a modular monolith and microservices for a 20-client CRM, including a measurable revisit trigger.
Record two alternatives, security/a11y/operations costs, owner, rollback and a measurable trigger.
Requirements as examples, not slogans
Convert stakeholder language into testable scenarios with explicit inputs, actor, constraints and failure behaviour. A requirement like 'fast search' is incomplete until you agree on data volume, latency, freshness and accessibility expectations.
Ambiguity is cheaper to resolve before the schema and UI embody it.
Given a new event with no venue address, show a clear unavailable-location state rather than fabricate directions.
Hands-on exercise · reveal the verification check
Write three Given/When/Then cases for a booking cancellation.
Another developer can predict the correct state from each case.
Quality attributes and architecture fitness
Scalability, recoverability, latency, security, accessibility and maintainability compete for engineering resources. Define measurable quality attributes and test them continuously with architecture fitness checks.
A decision that helps throughput may hurt deployment simplicity or data consistency.
Test whether page 95th-percentile latency remains acceptable at the expected concurrent users while error rate stays within budget.
Hands-on exercise · reveal the verification check
Write a measurable reliability and response-time target.
A CI or monitoring signal can reveal when the target fails.
Risk-first slicing and reversible decisions
Break a major project into thin end-to-end increments, prioritising the riskiest assumption first. Distinguish reversible choices such as UI colour from difficult-to-undo choices such as identity and persistence models.
Early feedback prevents enormous features from arriving as a single untestable merge.
Prove venue ingestion with 20 records before onboarding 20 cities and creating a production-wide schema.
Hands-on exercise · reveal the verification check
List the five highest-risk assumptions and the smallest test of each.
Each assumption has an observable result or is explicitly unresolved.
Engineering metrics without gaming the numbers
Flow metrics describe how work moves: lead time, deployment frequency, recovery time and failure. Product metrics capture outcomes such as successful checkout or accurate listings. Read numbers in context, not as employee rankings.
A rising commit count can coexist with worsening user outcomes and rework.
Track how often a new calendar event reaches staging correctly with an actual source link and no duplicate row.
Hands-on exercise · reveal the verification check
Make a delivery scorecard with one flow, one quality and one user metric.
Each metric has an owner and an action when it degrades.
Contracts, invariants and ownership
For each integration, declare who owns data, which fields are required, error semantics, freshness and who may change them. State invariants at system boundaries and enforce them in tests and database constraints.
The integration between two good modules is often where the actual bug lives.
An event importer owns provenance but the calendar owns rendering; both agree on event_id, location timezone, cancellation and duplicate semantics.
Hands-on exercise · reveal the verification check
Draw a one-page context diagram labeling each data owner.
No data field has two conflicting authoritative writers.
Accessibility and operations as design constraints
Design for keyboard, assistive technology, slow networks and failure recovery before the UI is polished. Include operational dashboards, backup and disaster scenarios in requirements rather than as post-launch cleanup.
A feature can work on a developer laptop and still exclude users or fail in production.
A pop-out guide must restore focus when closed, work with JS blocked, and render lesson HTML even if an asset is missing.
Hands-on exercise · reveal the verification check
Review one user journey with keyboard-only and simulated network failure.
Core tasks remain usable, or deficiencies are tracked explicitly.
Judgment and requirements
Engineering as hypothesis testing
Describe a design proposal as a falsifiable hypothesis: name the user outcome, assumptions, evidence and failure criteria. Run a tiny spike to test the riskiest part before building a large abstraction. Keep a distinction between technical feasibility and product usefulness.
A small experiment can invalidate weeks of planned implementation without risking production data.
Before designing a multi-source concert importer, test 25 real feeds for stable dates, venues, duplicates and cancellation evidence.
Hands-on exercise · reveal the verification check
Write a hypothesis for a new booking feature and a 30-record sample test.
Write an observed result and the decision it supports.
Judgment and requirements
Defining nonfunctional requirements with measurable service objectives
Translate vague quality words into explicit targets for latency, reliability, accessibility, recovery time and privacy. Name which journeys matter, their measurement method, expected usage and data freshness. Treat trade-offs as choices to revisit when evidence changes.
Without an operational definition, teams can honestly disagree about what fast, secure and ready mean.
For a CRM, define response-time and error-rate targets for booking creation, along with a restore drill and keyboard-only acceptance criteria.
Hands-on exercise · reveal the verification check
Write one measurable quality attribute for each of speed, reliability and accessibility.
Identify which test or dashboard would reveal a violation.
Architecture judgment
Ownership maps, bounded contexts and data contracts
For each business concept, identify the authoritative record, permitted writers, dependent readers and deletion policy. Distinguish identity records, appointment bookings and notification delivery; they may belong to different modules even when a UI combines them. Publish contracts that include state transitions and error behaviour.
Unclear ownership creates duplicated writes, stale UI states and contradictory reporting.
Let a booking module own time slots while the calendar projects them as read-only events, and let an invoice service own monetary state.
Hands-on exercise · reveal the verification check
Draw a context map for client, booking, invoice and email events.
No two modules may claim authoritative writes to the same lifecycle.
Cost of change: reversibility, dependency direction and observability
Prefer designs where ordinary changes affect one module and critical behaviour can be monitored. Compare a reversible CSS choice with an irreversible account-ID migration. Record the rollback path, coupling and affected integrations before choosing an architectural abstraction.
The most important engineering optimization is often the future cost of correcting a wrong guess.
Choose a modular monolith for a service CRM, keep external calendar sync behind an adapter and migrate records with verified backups.
Hands-on exercise · reveal the verification check
Choose one design decision and document reversibility, blast radius and rollback.
Describe the event that would trigger reconsideration.
Definition of done with accessible and operable evidence
A feature is done only when the acceptance examples pass, failure states are handled, the data contract is documented and deployment plus rollback evidence exists. Include keyboard interaction, readable errors, observability and maintenance ownership before counting a checkbox as completed.
Shipping code is different from shipping a trustworthy product capability.
A map route planner needs a real optimized result, correct mobile reordering, useful empty states, a loading indicator and a post-deploy verification check.
Hands-on exercise · reveal the verification check
Create a release checklist for a feature with five explicit checks.
A reviewer can observe the deployed behavior, not merely inspect code.