This repository was archived by the owner on Oct 19, 2018. It is now read-only.
Serialization/Deserialization Requirements & Implementation #96
Open
Description
From @ajjahn on December 9, 2015 16:18
Since I've been harping on this subject and recently some related issues (#94, #95) have been opened, it seems like a good time to get a discussion regarding where we'd like to see serialization for passing objects into the pre-rendering system to go and how we'd like it to work.
Here are my initial thoughts:
- Core classes in either the Ruby or Opal runtimes should not be opened up and extended with additional methods and behavior. This means removing
react_serializer
and_react_param_conversion
. I believe those to be an anti-pattern. We'd be much better suited using composition than extending the responsibilities of classes. A hash shouldn't care about the details of how it converts to a transport format and back. Building simple classes like,HashSerializer
,ArraySerializer
, etc, would separate concerns, and allow for serializers to be swapped out with custom objects.MyFancyHashThingSerializer
for example. - Core classes should be serialized and deserialized by default.
- Custom objects can provide custom serialization/deserialization objects.
BlogPostSerializer
for example. - Maybe provide something like a
SimpleObjectSerializer
that can be instructed which methods/attributes of a custom class should be serialized and deserialized without needing to define a custom serializer.
Question: What are some other scenarios and uses cases we should be taking into account?
Copied from original issue: zetachang/react.rb#96