All lessons in Software Engineering: Programs, Systems, and Maintainable Software

Software Engineering as Controlled Change

Connect requirements, implementation, tests, and maintenance in a small engineering task.

25 minutes · Free lesson

What you will learn

  • Describe a software change in terms of behavior, evidence, and maintenance consequences.
  • Separate a small deliverable from assumptions and future work.
  • Assemble a trace from one requirement to implementation and verification.

You inherit a lending application. Its screen says a copy is available, but two members sometimes receive successful borrowing messages for the same item. The team could patch the screen, add a check to one function, or change how the database enforces borrowing. Each is a code change; only a change tied to the actual rule and a reproducible failure is a defensible engineering response.

This course follows a small library system from requirements to a maintained implementation. You should already be able to write functions, loops, and simple tests in one programming language. You will use those skills to make behavior explicit, choose representations, reason about computer resources, and leave evidence another developer can inspect.

Think beyond the successful execution

A program produces results for inputs. Software engineering also asks how the program changes, who can understand it, which assumptions its environment must satisfy, and what happens outside the demonstrated happy path. A useful solution includes its implementation and the reasoning needed to modify it safely.

For a borrow operation, the happy path creates a loan. Relevant alternatives include an unknown copy, an ineligible member, an invalid date, a copy already on loan, and two competing requests. Maintenance questions include adding a new membership rule without rewriting storage code and preserving old loans when the schema changes.

Do not equate engineering with paperwork volume. A five-line transition table can prevent a defect that twenty pages of general architecture language would not expose. The criterion is whether an artifact helps someone decide, implement, test, review, or change behavior.

Make the unit of work observable

A task such as “improve lending” is too broad to verify. A bounded change states the starting behavior, intended behavior, scope, and evidence. For example: when two clients attempt to borrow the same available copy, exactly one new active loan may be committed; the losing operation receives a conflict; existing history remains unchanged.

Keep a list of assumptions alongside the change. The first release uses date values rather than billing timestamps, has no fines, and does not support renewals. Those are boundaries, not accidental omissions. An assumption becomes a defect when users rely on behavior the implementation never promised or when the team silently changes its meaning.

ArtifactQuestion it answersLending example
RequirementWhat must be true for the user?One copy cannot have two active borrowers
Domain modelWhat facts and transitions represent it?A loan has copy, member, and return state
ImplementationWhere is the rule enforced?Service operation plus database constraint
Test evidenceWhich observations support correctness?Concurrent attempts and persisted-row checks
HandoffWhat can the next engineer safely change?Named invariant, known limits, reproduction command

The artifacts should refer to the same rule. If the requirement says one active loan but the test only checks a success message, the trace is incomplete.

Use feedback in small increments

Begin with the smallest behavior that crosses a meaningful boundary. For the library, creating a title without persistence may be a useful domain exercise, but a complete vertical slice can accept a borrow command, validate it, store a loan, and report its result. It need not include every feature or a polished interface.

Short iterations let you discover misunderstandings while the implementation remains inexpensive to change. They do not remove the need for design. You design enough to understand the next risk, implement the slice, inspect evidence, and revise the model when the evidence disagrees.

A plan-driven approach may fix more decisions before construction; an iterative approach revisits them more frequently. Neither label proves that requirements are correct or that tests are sufficient. Choose practices for the uncertainty and consequences of the task rather than assuming a process name guarantees quality.

Worked example

Reduce an unreviewable assignment

  1. The initial request is to modernize the library application. It has no observable stopping condition.
  2. Choose one defect: duplicate active loans for one physical copy.
  3. Define the rule: the committed active-loan count for each copy is at most one.
  4. Reproduce the defect using two independent attempts against the same copy, retaining the resulting rows as evidence.
  5. Implement the enforcement boundary and a meaningful failure result. Preserve returned-loan history.
  6. Verify one winner, one conflict, no extra active loan, and unchanged unrelated records. Record what the change does not address, such as renewals.

Balance qualities through concrete constraints

Correctness, responsiveness, readability, and changeability can interact. A faster query that double-counts loans is not a successful optimization. A flexible abstraction that obscures the invariant may make a small service harder to maintain. Compare alternatives against the current problem and likely changes.

Use quantities where they help. If a desk handles 200 copies, an in-memory linear scan may be a reasonable teaching baseline. If a report scans 20 million loan rows, query shape and indexing deserve separate investigation. The scale assumption belongs in the explanation; “fast” does not.

Avoid claiming more than your evidence establishes. Tests over a finite set do not prove every possible execution correct. A benchmark on a laptop does not establish production capacity. A self-checked capstone demonstrates specific work; it does not certify readiness for every engineering role.

Keep an engineering notebook

For each required activity, retain the requirement, the smallest useful model, the implementation or trace, the commands that reproduce your evidence, and a short explanation of remaining limits. Plain files are enough. Prefer a result another person can reproduce over a screenshot that hides the setup.

By the end of the core path, you should have an algorithm lab, a transactional lending implementation, a defect investigation, and an engineering handoff. The optional workshop adds timed coding, debugging, and design practice. The main project is required because explaining principles without applying them does not demonstrate the promised capability.

Exercise

A patch adds an availability check to the web form and its test asserts that the button becomes disabled. Explain why this evidence is insufficient for the duplicate-loan defect and propose a stronger observation.

Check your answer

The form is only one caller, and two callers can observe availability before either write commits. Test competing borrow operations at the actual persistence boundary and inspect committed loans. The required observation is at most one active loan with an explicit losing result, not merely a disabled button.

Exercise

Write a bounded change statement for retaining loan history after return. Include one success condition and one condition about unchanged behavior.

Check your answer

Returning an active loan records its return date and leaves its original member, copy, borrowed date, and due date intact. A historical query must still return the loan. The copy becomes eligible for a later borrowing, while other copies and their active loans remain unchanged.

Summary

Engineering connects behavior to representation, implementation, evidence, and future change. Work in bounded increments, record assumptions, and make claims proportional to the checks you performed. A useful artifact helps another person understand or change the system.

Next action

Create a project notebook with sections for requirements, decisions, experiments, and handoff. Write the first lending rule in a form that can be checked against stored records.

Choose another lesson