In my opinion, this is a weakness of the notebook interface, which I forgive because of its many virtues.
I use two methods for processing sets of data.
The first is easy for simple applications. In this case I develop the calculation in multiple cells in the usual way. I can follow the calculation by seeing the results one cell at a time. When I am happy with the result, I delete all the output, separate all lines with semicolons, and merge the result into a single cell. I use that single cell as the bases for a function, generally defined in a Module to localize variables. This can the be used with Table or Map to process a set of inputs. I maintain both the multiple-cell notebook and the function.
When the calculations are more complicated, I use a Master-Slave notebook method. This takes advantage of the fact that all notebooks in a single session share the kernel, and therefor have variable definitions in common. The Master contains the sets of data. It explicitly opens the slave which performs the calculations. The master can set values to global variables used by the slave and then call NotebookEvaluate on the slave to perform the calculations. The Slave sets values to one or more global variables as its output. When NotebookEvaluate finishes, the Master has the results from the Slave to do with as needed. The Slave is essentially a subroutine for the Master.
I find the second method much better for doing complicated work. I attach a made-up example in notebooks.
Kind regards,
David
Attachments: