When is it worth designing every edge case vs handing off the rules?

On this page

Designing every edge case explicitly is worth it when the cases are unpredictable, high-impact, or where a wrong guess would be costly, and handing off clear rules is more efficient when the cases follow a pattern a developer can apply consistently. The deciding test is whether a rule reliably generates the right result. If a stated rule produces the correct outcome every time it is applied, hand off the rule. If it would not, or if the cost of it being slightly wrong is high, design the case. Specify the unpredictable; rule the systematic.

The instinct to design every possible case to be thorough feels responsible, but it spends scarce effort on the cases that least need it. The systematic cases, by definition, are the ones a rule already handles correctly, so drawing each one is redundant labor that produces no new information. Worse, it crowds out attention from the cases that genuinely need a hand, the strange ones a rule cannot anticipate. Thoroughness is not drawing everything; it is drawing the things that would otherwise go wrong, and trusting a rule with the things that would not.

A rule reliably generates the right result when the variation is mechanical and the pattern holds across instances. Text truncation is the classic example: the rule truncate to two lines with an ellipsis applies cleanly to a title, a card, a list item, and a hundred items you never drew, and every result is correct because the behavior does not change with the content. You do not need to design the card with a short title and the card with a long title and the card with a medium title. You need to state the rule once, and the developer will apply it everywhere, consistently, including in places you never imagined.

The opposite case is where a rule breaks down because the variation is not mechanical, and that is exactly where explicit design earns its cost. Suppose a data card has to display a value that can be a small number, a huge number, a negative, a currency, a percentage, or missing entirely, and each of those changes not just the text but the meaning and the right visual treatment, a missing value should look different from a zero, a negative might need color, a huge number might need abbreviation. No single rule produces the right answer across all of those, and guessing wrong on a financial figure is expensive. Here you design the cases, because the cost of a bad guess is real and a rule cannot be trusted to cover them.

The edge case is honesty about which kind of case you actually have, because the danger is misclassifying one as the other. A case that looks systematic but hides a high-stakes exception should be designed, not ruled, the cost of the exception outweighs the convenience of the rule. A case that looks special but is really just one instance of a clean pattern should be ruled, not drawn, designing it individually adds nothing and risks inconsistency with its siblings. The test is not how the case feels but whether a rule applied to it would land correctly and whether you could afford it if it did not.

In practice, before handoff, sort the cases into two piles by asking of each one whether a rule would reliably generate the right result and what it costs if the rule is slightly off. Write rules for the systematic cases and write them clearly enough to apply unsupervised, and design the unpredictable, high-impact ones explicitly so nothing is left to a costly guess. Specify the cases a rule cannot safely cover and hand off rules for the cases it can, and you spend your effort exactly where it changes the outcome.

Leave a comment

Your email address will not be published. Required fields are marked *