I'm designing an app in MA to solve a fairly complicated problem.
It'll have a large data as input, in the process it'll generate quite a bit of intermediate data, at the end there will be a solution set of data and finally a report will have to be generated.
I've coded most of it already in a single unit and it is quickly becoming unmanageable and extremely hard to debug and maintain.
Because of the complexity and to ease the design I've decided to split it all up in several packages. The problem however is that I'm not sure how to best deal with the global vars. Here's a taste of what I have so far:
- inputData1: list
- inputData2:list
- inputData3: a large list
- inputData4: a large list too
a bunch of small parameters that may or may not be set by the user, like par1->whatever1, par2->whatever2....
I'm thinking of having the following packages:
- inputPackages: routines to populate the various input lists from different file formats etc
- dataPackage: data handling routines, once the input lists are generated - like add element, remove element, find element etc
- dataCrunch: core package to solve the problem, generates solutionList, interList1, interList2.....+others
- supportPackage: varous more generic data crunching routines that can live in a separate unit
- reportsPackage: routines to generate final user friendly reports from the solution data
- plotPackage: routines to generate fancy plots
Now - obviously most of the units will need access to the original input data lists as well as the intermediate lists.
Any ideas on how to organize this in order to minimize the use of global vars?
Can global vars be avoided altogether in this case and if yes - how?
Thanks in advance!