This is (IMHO) a fundamental question in computer programming. The discussion quickly enters into areas of Architecture, Development processes and so on. Since I'm not actually a trained Programmer (I'm a learned Programmer) I don't know what these all really mean.
In my experience, it's important to know what you want to have at the end of your work before starting to write the smaller pieces. You need to know HOW, WHERE and WHEN the parts should work together. Then you can start thinking about the best way to do it. Make sure you keep functions grouped logically. Try to keep "variables" local, so that they don't need to be passed around all over the place (Filenames for example). This will lower the risk of closing a file in onepart of the program, while trying to write to it in another part - thus causing a problem. Keep all writing to a single file in a single place. (for example). I've started linking programm "parts" together using Queues, as this gives automatically a clean cut between the components, forcing you at the beginning to define the interface. It's also easier to debug, because the amount of "crossover" between components is reduced to a minimum. Having said all this, I'll leave the way for other, more experienced "architects" to answer. Shane.
