What exactly should a computer program do? How will you know if the program you have written or requested to be written for you does what you need it to do?
It’s really a whole lot simpler than you might think.
If you, as a business user, can define what information is available to accomplish the automated task at hand (the purpose of the program). And, you can define, in detail, the processes that are to be done using this available information (the calculations, manipulations, sorting, totaling, etc.). And define the output results that this program should be expected to provide to you as the user, then you have defined the entirety of your requested program.
A program should only ever take INPUT, PROCESS it according to a business user’s specifications, and create OUTPUT requested by that user. If a program tries to do anything else other than Process Input to create defined Output, then it is doing more than and probably unexpected things that no one asked the programmer to create. This would be a BAD outcome.
The Software Engineering science of defining these specifications in these terms has been referred to as a IPO Diagram with three columns. Can you guess what these columns might be?
If you try this at an appropriate level of detail, you should be able to get a clear understanding of how this can work for you in your business need; HOWEVER, remember that the amount of details you put into this effort will be reflected in the completeness and accuracy of the results.