Besides the rather short Google provided style guide, here are my thoughts on naming Google Protocol Buffer messages.
Use "Message" at the end of message types names.
- This makes it easy to see in source code that a class is a protobuf generated class. This also has the advantage that if I have a rich domain specific class, then it can have the real name, say AddressBookMessage for the protobuf class and AddressBook for the real class.
For Java users, it appears that having
java_outer_classnameend inProtosis standard.- I didn't notice this initially, so my current protobuf classes are in
com.example.project.protobuf.MyProtos, but I don't see a reason to keep it there given that we need to have a containing class, so it could be moved tocom.example.protobuf.MyProtosunless there are no classes in the project's top package.
- I didn't notice this initially, so my current protobuf classes are in
Start enums at 0 to match C/C++.
Use a singular name for a repeated field.
- Most of the generated methods sound better with a singular field name, even if it is repeated, e.g. message->add_child(), instead of message->add_children() if one had a repeated child field.
Are there any other standards people use or differ from these?