You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objects are currently serialized in Mapper but deserialized in Retrieval. I felt horrible about doing it this way, but it was necessary to get the functionality I needed. What I'd like to do is extract all of that behavior from both of those classes into Serializer objects.
Then in the Mapper, we can do something like Serializer.new(object).serialize and in Retrieval Serializer.new(serialized_data).unserialize. This will also make it easier to extract state injection from Mapper and Retrieval objects (where it doesn't belong).
The text was updated successfully, but these errors were encountered:
While working on this, I have been unable to come up with a way to keep a unidirectional dependency graph in a clean way. The problem comes about when we need to serialize an object that contains other objects that the DB cannot serialize natively. For example, if we have an Article that contains an array of Comments, we need to know how to serialize the comments, too. But in order to do that, we need to know which attributes to serialize on it, which are defined within its mapper. Then we have a mapper that depends on a serializer which, in turn, depends on another mapper.
The only way I've been able to come up with to do this without circular dependencies is for the first mapper to pass along the attribute sets (or maybe full mappers?) for each not-natively serializable object in the first object's graph. I'm not sure this is a good idea, though. It feels like it'd just create a mess.
Objects are currently serialized in
Mapper
but deserialized inRetrieval
. I felt horrible about doing it this way, but it was necessary to get the functionality I needed. What I'd like to do is extract all of that behavior from both of those classes intoSerializer
objects.Then in the Mapper, we can do something like
Serializer.new(object).serialize
and in RetrievalSerializer.new(serialized_data).unserialize
. This will also make it easier to extract state injection fromMapper
andRetrieval
objects (where it doesn't belong).The text was updated successfully, but these errors were encountered: