I am creating a data serialization/deserialization mechanism for essentially a persistent storage object. Due to the variety of systems this mechanism could run on, there needs to be a a variable number of "drivers" that could be used to serialize or deserialize the data.
I am having trouble figuring out the appropriate level of abstraction for this system. Primarily, when I construct a "driver", should it have a reference to the object I am storing, or should that object be passed in to the various write functions?
So, let's say I have an some
DataAccessLayer which wraps my
DataAccessLayer necessarily contains a reference to some
DataObject which it also wraps, and it uses the
DataAccessDriver to actually keep some serialized representation of the
The question is, should the
DataAccessDriver be constructed with a reference to the
DataObject, or should I pass in the
DataObject for every function call the