If F map X to Y the inverse of F map Y to X.

In mathematics the domain is the input values that a function can map to the codomain of output values. Both the domain and the codomain are part of the functions definition.

Software development is not always as strict, but the mathematical mindset can help us in writing predictable code.

In Test Driven Development (TDD) we let the tests and the code grow together, creating one failing test at the time and making it pass.

Deliberately deciding what input values are valid for a function is a part of TDD. We then also define the behaviour if the function can be used outside of its definition. (In some languages this is done through the definition of signatures and types.)

TDD is a thinking tool more than a way to write test.

Let it help you define your domain and its boundaries.

Related texts

A single frosted leaf with clear contours and veins.

TDD in the context of writing code to be read

Wunder Baum hanging from a car window (Known as Little Trees in most English-speaking countries)

Wunderbaum testing