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.


Comment on the blog!

Create a comment by emailing me.
I will then add the comment to the post.

Open an email to start writing.

Related texts

A red neonsign of a questionmark

The question trick

Cartoon style BOOM in red on a background of an explosion in yellow

The dynamite double