NimbleKernel

Developer Software

Give one calculation a complete boundary

Imagine a teaching example that calculates a subtotal for one order line. It accepts a whole-number quantity and a unit price expressed in whole minor currency units. For this exercise the currency uses one hundred minor units per major unit. The example is a design worksheet, not a tested package or a complete order-pricing system.

Input contract in the NimbleKernel subtotal worksheetquantityWhole itemsNonnegativeunitMinorMinor unitsNonnegative integerNumeric limit: to be defined

01

Write the input contract before the example

The proposed inputs are quantity and unitMinor. Both must be nonnegative whole numbers within a range chosen by the implementation. Record that the range is still to be selected; a machine number type is not unlimited. The result is subtotalMinor, obtained by multiplication. Empty text, fractional quantities and negative values fall outside this exercise’s contract. The worksheet asks the implementer to define how such inputs are rejected before integration. Parsing a form and displaying an error belong to the caller unless the chosen interface explicitly says otherwise.

Worked subtotal in the NimbleKernel subtotal worksheetquantity × unitMinor3 × 450 = 1350Result: 1350 minor unitsDisplay separately: 13.50

02

Trace one result without hiding its units

Use quantity 3 and unitMinor 450. Multiplication gives subtotalMinor 1350. Under the stated hundred-to-one convention, a separate display layer could present that as 13.50 major units. The arithmetic does not choose a currency symbol or a locale. Keep the input names and units on the worksheet so 450 is not mistaken for 450 major units. A second proposed case with quantity zero would produce zero under the same rule. These are expected examples for later checks, not reports that any software has passed them.

Responsibility boundary in the NimbleKernel subtotal worksheetSmall coreMultiply inputsReturn subtotalSurrounding workTax and discountsShippingFormattingExpected example ≠ executed test

03

List what the small core deliberately leaves to its callers

Tax, discounts, shipping, currency conversion and formatting are outside this calculation. Record them in a surrounding-responsibilities column, together with the unresolved numeric limit and invalid-input response. The reusable template contains purpose, input names, units, accepted range, output, worked example and exclusions. When an implementation exists, attach actual check results separately, including boundary values. If the scope expands to fractional quantities, revise the contract and examples together. Keeping the worksheet aligned with the code makes a small responsibility easier to review and reuse.

Subtotal boundary ↗

Explore NimbleKernel

Held for potential development. Acquisition inquiries may be considered.

Acquisition ↗