If you don’t know, ask – if you know, share! ~ opensource mindset
by Marco Bravo
Three different categories of data in software:
By “data” I generally mean “variables in code”, but the same principles could be applied to files on a disk, or tables in a database, or whatever else.
These three categories are disjoint: that is, if a piece of data falls into one of them, it should not also be treated like one of the others. Different languages will vary in their ability to express this constraint via the type system or otherwise, so it’s better to think of it as a convention or a frame of mind (though if you can actually enforce it, that is of course all the better).
A Constant, in this context, is information that doesn’t change during the course of running the program.
State is information that naturally changes during the course of running the program.
Cached values are information that is derived directly from Constants and/or State.
To summarize: