Arbitrary blocks are useful to introduce intermediary variables that
are only used in special cases of a computation.
This is a common pattern in scientific computing, where numeric
- rely on a lot of parameters or intermediary quantities;
- have to deal with a lot of special cases.
Because of the second point, it is useful to introduce temporary
variables of limited scope, which is achieved wether by using an
arbitrary block or by introducing an auxiliary function.
While introducing an auxiliary function may look like a no brainer
or a best practice to blindly follow, there is actually little
benefits to do so in this particular situation.
Because there is a lot of parameters and intermediary quantities, we
want to introduce a structure to pass these to the auxilary
But, since we want to be consequent with our practices, we will not
introduce only one auxiliary function but several. So, wether we
introduce ad-hoc structures conveying parameters for each function,
which introduce a lot of code-overhead to move parameters back and
forth, or we introduce a one will rule them all worksheet structure,
which contains all our variables but looks like a grabpack of bits
without consistence, where at any time only the half of parameters
have an interesting meaning.
Therefore these auxiliary structures are typically cumbersome and
using them means choosing between code-bloat or introduce an
abstraction whose scope is too broad and weaken the meaning of the
program, instead of stregthen it.
Introducing auxiliary functions could ease unit testing of the
program by introducing a finer test granularity but combining unit
testing for not that low-level procedures and regression testing in
the form of comparisons (with numdiff) of numeric traces of the
procedures does an equally good job.