[Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

Chris Roy-Smith chris_roysmith at internode.on.net
Wed Jul 31 02:36:06 EDT 2019


On 31/7/19 2:21 am, boB Stepp wrote:
> I have been using various iterations of a solitaire scorekeeper
> program to explore different programming thoughts.  In my latest
> musings I am wondering about -- in general -- whether it is best to
> store calculated data values in a file and reload these values, or
> whether to recalculate such data upon each new run of a program.  In
> terms of my solitaire scorekeeper program is it better to store "Hand
> Number, Date, Time, Score, Total Score" or instead, "Hand Number,
> Date, Time, Score"?  Of course I don't really need to store hand
> number since it is easily determined by its row/record number in its
> csv file.
> 
> In this trivial example I cannot imagine there is any realistic
> difference between the two approaches, but I am trying to generalize
> my thoughts for potentially much more expensive calculations, very
> large data sets, and what is the likelihood of storage errors
> occurring in files.  Any thoughts on this?
> 
> TIA!
> 
 From a scientific viewpoint, you want to keep the raw data, so you can 
perform other calculations that you may not have thought of yet. But 
that's not got much to do with programming ;)


More information about the Tutor mailing list