Sixteen weeksscene 6 / 34~3 min
When code goes wrong
Priya's Friday question: the runner nobody follows.
Priya’s Friday question arrives kindly, over the top of a laptop, in the last hour of a week Finn had privately marked as finished: what does it do for a runner nobody follows?
Finn checks. It crashes. Weeks end like this.
The vocabulary of wrong
The broad word for software misbehaving is errorConcept · lights on your maperrorThe general word for a problem that stops software behaving as intended, from bad syntax to a missing file to a service that will not answer. “It returned an error” means the operation did not complete.. It covers everything from a typo to a dead disk, which is exactly why engineers reach for a sharper one when the flow of a program actually breaks, and the sharper word is exceptionConcept · lights on your mapexceptionAn event that interrupts a program’s normal flow because something unusual happened. Code throws one; other code can catch it and respond, or the operation stops there.: the program hits something it cannot proceed past, and throws. Code elsewhere can catch the throw and respond gracefully. Nothing caught Finn’s, so the delivery simply stopped.
The cause is the oldest one there is. A runner with no followers has, in the follower slot, nothing at all, and nothing is a real value with real teeth. null handlingConcept · lights on your mapnull handlingNull (None in some languages, nil in others) is the special value meaning no value exists, as distinct from empty text or an empty list. Null handling is checking for absence before trying to use what might not be there. is the discipline of asking is there anything here before acting, and forgetting to ask is plausibly the most expensive habit in the history of the industry.
Tuesday and everything else
Finn’s Thursday version handled the happy pathConcept · lights on your maphappy pathThe scenario where everything goes right: valid input, everything in stock, network fine. Quick to build, great in demos, and the smallest part of the real work.: follower exists, runner mid-race, network fine. The crash lived on an edge caseConcept · lights on your mapedge caseA scenario at the boundaries: zero of something, an emoji in a name, two taps at once. Individually rare, collectively constant. Handling them is the bulk of professional engineering., and Priya’s whole question was an edge case wearing a laptop. Zero followers. A cheer sent at the exact second of the finish. A message that is nothing but emoji at a race whose v1 dropped emoji from scope. Individually rare, collectively constant, and asking what are the edge cases is the single most engineer-respected question a non-engineer can bring to a meeting.
Three bots, as engineers call the automated checkers, also read Finn’s code before any human does. lintingRecognition — just know it existslintingAn automated checker that reads source code for suspicious patterns and style problems, like spell-check for code. It runs constantly in an engineer’s editor. nags about style and suspicious patterns; static analysisRecognition — just know it existsstatic analysisThe broader family of tools that inspect code without running it, hunting possible defects and unsafe behaviour. hunts deeper defects without running anything; and type checkingRecognition — just know it existstype checkingAutomatically verifying that values are used in ways matching their data types, such as warning when code treats text as a number. catches a string being treated as a number before it ever runs. The bots caught none of this, which is the lesson inside the lesson: they catch the mechanical wrongs. The runner nobody follows takes a Priya.
Monday of week three, Finn handles the nothing. Two lines. Then Finn goes shopping.
End of scene
This scene covers: error, exception, null handling, edge case, happy path, linting, static analysis, type checking