Implement only presently required complexity
Defer speculative features and abstractions until a concrete requirement justifies them.
These examples and illustrative results are independently authored teaching materials, not measured model results.
Use case
An existing service needs one percentage-discount function, with no other discount mode requested. The teaching contract uses nonnegative integer cents and an integer percentage from 0 to 100; calculate floor(amount * (100 - percent) / 100) and reject invalid inputs. An integer-validation utility already exists.
Mechanism
List current required behavior and examples, then find existing validation and the calling interface. Implement the calculation, reuse validation and check boundaries. Trace every addition to a requirement. Add strategy registration, plugins or notifications only when a concrete use case needs them, rather than anticipating possible expansion.
Bad example
Add the discount behavior using the contract above. Also design strategy classes, plugin registration, dynamic configuration and notifications for the future, although only percentage discounts are currently used.
Good example
Implement the percentage discount under the teaching contract above, reusing integer validation. Accept integer amount>=0 and integer percent in 0–100; use the specified floor formula and reject invalid inputs. Check 10000 cents with 10% yields 9000, 0% preserves the amount and 100% yields zero. Implement the current interface only. If an abstraction is necessary, identify the existing caller requirement it serves.
Why the change matters
Unused expansion layers add interfaces to understand and maintain without helping this calculation. Connecting implementation to inputs, the formula and current callers limits speculative complexity without removing necessary validation to save lines.
Observable expectation
Check the three normal cases plus negative amounts, fractional percentages and percentages above 100. Illustrative results are discount(10000,10)=9000, discount(10000,0)=10000 and discount(10000,100)=0; invalid inputs fail under the contract.
Explain the present requirement behind every added class, configuration and dependency. Unsupported expansion is not a completion condition, and line count alone is not a pass criterion.
Limits
The formula and rounding are teaching business rules. Define real currency precision, maximum amounts and safe-integer limits from the project. Preserve necessary safety, validation and existing architectural contracts; the method does not prohibit all abstraction.