Tomasz Blachowicz wrote:
On Wed, Jan 7, 2009 at 10:50 PM, Shawn Pearce <[email protected]> wrote:
Applications that add two numbers together and return the result are fairly
common for an RPC sort of example.  The body of the implementation is
trivial, its the RPC framing that is interesting to show.

What about just a simple add server?

 message AddRequest { required int32 a = 1; optional int32 b = 2; }
 message AddResult    { required int32 r = 1; }

?

This is good idea I guess, I can provide the implementation for such a add
server. Do you guys have any other ideas?

How about a stack calculator? You could demonstrate the extendability quite compactly with it:

First you have two messages defined
- a number
- the addition operator (+)

Then you can add a multiplication operator (*)

If I've understood protocol buffers correctly, an old client using just the addition should be able to operate just fine, even though a new message has been added to the protocol.

--

Eero

Reply via email to