When I say: "A variable called ThisValue has the return value of ThisFunction with argument ThatValue"
ThisValue = ThisFunction(ThatValue)
Or, when I give short lengths to the parameter names:
y = f(x)
Then, I have stated that the value of y is equal to the result of function f with as argument the value x. For example, when f(x) = x2, that is, the "square of x" which means "x times x", then y is equal to the square of x. Say, x=2, then y is the square of 2, which is equal to 4.
In Mathematics, when a truth is found, this equality holds forever. The square of 2 will always be 4.
In software development however, this function syntaxis is used in programs, but the programs change. The functional language is utilised to assign values to names. And there is no more or less truth in assigning 1 to x or 2 to x. This is called a statement. And if I assign 1 to x today, and 2 to x tomorrow, also y will give a different value when I look today versus when I look tomorrow.
When a computer program changes, it may produce different values. When another computer program depends on the values of this one, it is useful to be able to tell whether the produced values still make sense (...)
This is the purpose of Tests.
- Business Logic and Tests
- unit tests, integration tests