Ian Collins said:
Testing. A large, complex, function is hard to test. More less complex
functions are easier to test.
I don't see that. You're testing inputs and outputs. A function which is
'complex' in the amount of logic it contains, can still have simple
requirements and be straightforward to test.
But one which is arbitrarily broken up into pieces, now needs to have a
meaningful set of specifications drawn up for each part.
That's why code written test first won't contain large, complex,
functions.
That's right; you build a framework of one hundred functions, all initially
empty (or with some stub). They each do ten different things depending on
some parameter. Each of those things is straightforward by itself, but can
be added one by one, function by function. In the end you have 5000
different things split amongst 100 functions.
Your way, there would be 5000 2-line functions. Plus 100 dispatcher
functions. And most of the relationships amongst each group of ten, has
disappeared.