Re: [protobuf] is protobuf the right choice in this case?
Hi Michael, Thanks for your response. As you said in your email, taking advantage of the introspection capabilities allows me to implement some solution for automatic conversion. I was already having a look at pb2json :-) But my question is more related to the way in which we handle our model classes internally and how this matches with protocol buffers. The model is a Tree Structure that suffers changes at runtime in terms of Node operations (insertion, deletion, moving subtrees, etc.) so I was wondering if using protocol buffers would be appropriate for this case. Thanks. 2013/4/22 Michael Haberler mai...@mah.priv.at Am 20.04.2013 um 14:17 schrieb balche8 anibal.cheha...@gmail.com: Hi all, I'm working on a project that involves two layers: one is written in C++ and the other one in Javascript. The C++ layer contains the model of the application in form of a tree in a similar way as HTML does (nothing really complicated, just elements with attributes). The interaction between these two layers is done using JSON. We manually implement the classes that serialize/deserialize JSON requests/responses and it is becoming a waste of time (plus the impact in maintenance). Why are you doing it manually? The protobuf schema and introspection capabilities are strong enough to support completely automatic conversion while validating against the protobuf schema see a Python example here: translator: http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=blob;f=src/protobuf/examples/json.py;h=80c21ca23f8673afead2c0afc9870344ca8a1975;hb=0623bcc7d68029bea378045e57cdcf7dc5216f7f usage: http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=blob;f=src/protobuf/examples/encdec.py;h=4e947b67dd57501f4645c3cca7696281b61cc9f5;hb=0623bcc7d68029bea378045e57cdcf7dc5216f7f needs cleaning to run standalone, but you get the idea what I think the best route is to redo the above in C++, maybe starting with this https://github.com/renenglish/pb2json and doing the other direction based on the ideas above - Michael I was thinking about using protocol buffers to describe our model in terms of .proto files and then write a layer that automatically performs the serialization/deserialization to/from JSON according to our schemas. I started to look at protocol buffers recently so I might be asking something stupid. My question is: is protobuf the right choice to represent our data model when: 1. the model consists of hierarchy of classes. 2. a model instance is a tree (objects are connected creating a tree structure) 3. the model not static: these tree suffer changes (tree operations like add/delete/move/update nodes, etc.) Thanks in advance. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[protobuf] is protobuf the right choice in this case?
Hi all, I'm working on a project that involves two layers: one is written in C++ and the other one in Javascript. The C++ layer contains the model of the application in form of a tree in a similar way as HTML does (nothing really complicated, just elements with attributes). The interaction between these two layers is done using JSON. We manually implement the classes that serialize/deserialize JSON requests/responses and it is becoming a waste of time (plus the impact in maintenance). I was thinking about using protocol buffers to describe our model in terms of .proto files and then write a layer that automatically performs the serialization/deserialization to/from JSON according to our schemas. I started to look at protocol buffers recently so I might be asking something stupid. My question is: is protobuf the right choice to represent our data model when: 1. the model consists of hierarchy of classes. 2. a model instance is a tree (objects are connected creating a tree structure) 3. the model not static: these tree suffer changes (tree operations like add/delete/move/update nodes, etc.) Thanks in advance. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] is protobuf the right choice in this case?
Am 20.04.2013 um 14:17 schrieb balche8 anibal.cheha...@gmail.com: Hi all, I'm working on a project that involves two layers: one is written in C++ and the other one in Javascript. The C++ layer contains the model of the application in form of a tree in a similar way as HTML does (nothing really complicated, just elements with attributes). The interaction between these two layers is done using JSON. We manually implement the classes that serialize/deserialize JSON requests/responses and it is becoming a waste of time (plus the impact in maintenance). Why are you doing it manually? The protobuf schema and introspection capabilities are strong enough to support completely automatic conversion while validating against the protobuf schema see a Python example here: translator: http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=blob;f=src/protobuf/examples/json.py;h=80c21ca23f8673afead2c0afc9870344ca8a1975;hb=0623bcc7d68029bea378045e57cdcf7dc5216f7f usage: http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=blob;f=src/protobuf/examples/encdec.py;h=4e947b67dd57501f4645c3cca7696281b61cc9f5;hb=0623bcc7d68029bea378045e57cdcf7dc5216f7f needs cleaning to run standalone, but you get the idea what I think the best route is to redo the above in C++, maybe starting with this https://github.com/renenglish/pb2json and doing the other direction based on the ideas above - Michael I was thinking about using protocol buffers to describe our model in terms of .proto files and then write a layer that automatically performs the serialization/deserialization to/from JSON according to our schemas. I started to look at protocol buffers recently so I might be asking something stupid. My question is: is protobuf the right choice to represent our data model when: 1. the model consists of hierarchy of classes. 2. a model instance is a tree (objects are connected creating a tree structure) 3. the model not static: these tree suffer changes (tree operations like add/delete/move/update nodes, etc.) Thanks in advance. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.