We are having a discussion about design. Keep into account this is fortran, so we can't be too smart. We have the following classes: Application, System, Calculator, CalculatorSimple, CalculatorPeriodic, Result.
Application is an application object which handles System objects. In order to compute information on the System object, the Application passes System to a Calculator, which returns a Result.
Inside Calculator there are two specialized classes CalculatorSimple, and CalculatorComplex, which act on System depending on information available on the system itself. Some Systems require CalculatorSimple. Others require CalculatorComplex. The decision happens inside Calculator, and the Result object may contain additional information if the CalculatorComplex was run. These additional info can be queried with methods on the Result object, to test if the information is present or not. This info is of small size.
To keep separation of roles, I want to keep this part unaware of input output. The Result object is received by the Application, and then the Application has the role of writing the data onto the file, according to what it finds on the Result object. A colleague instead proposes to pass the file to the Calculator object, and have it percolate through the chain so that stuff is written directly on the file.
The additional point is that we must have only one output file, so when the program runs in parallel, only the master node must write on the output file, which is identified via an absolute path and due to a limitation of our raw IO lib cannot be accessed by MPI slave processes.
We need an independent opinion. What would you do ?
Edit: thanks. I spread votes and awards as much as I could, as there's clearly not a correct answer, just a set of feedbacks.