2

Protobuf prefer compiling xxx.proto to source code (like protoc)

other than a liberary just loading xxx.proto at runtime (like DynamicMessage, protobuf-dynamic)

Why more projects prefer this way?

some compares:

  • compute: compile vs runtime
  • reload: recompile-proto + recompile-program + restart vs reload config
  • check syntax: compile vs any time
  • client update: rebuild-client + download vs download-proto + reload
fanlix
  • 1,248
  • 1
  • 13
  • 22

1 Answers1

1

Many programming languages are not scripting languages, C++ for instance. For those type of languages it is preferred and often required to know what you are dealing with at compile time. This instead of generating the message class format at run time. If you do that you need a lot of type checking and availability checking to have the code working properly and consistent. In theory you could supply a different proto file in which case the code should not crash.

Bart
  • 1,405
  • 6
  • 32