Is this a good idea to use Protocol Buffers instead of JSON to transfer data in android app?

Theoretically, Protocol Buffers should be quite a bit lighter weight. Only by testing your specific situation will tell you if it's worth it or not though. Protocol Buffers and JSON are so easy to implement, that I'd suggest trying it both ways, and see which one you prefer.

Theoretically, Protocol Buffers should be quite a bit lighter weight. Only by testing your specific situation will tell you if it's worth it or not though. Protocol Buffers and JSON are so easy to implement, that I'd suggest trying it both ways, and see which one you prefer.

I believe that Protocol Buffers also builds in some support for ensuring backward compatible deserialization. You have to do that on your own with JSON.

1 For the "Only by testing your specific situation will tell you if it's worth it or not though. " -- JSON has the advantage of being easily human parse-able. The same can not be said for protocol-buffers.As far as backwards compatibility ... I'd say it's a wash.

It doesn't even apply in JSON (except for the fields looked for) and is required in protocol-buffers because of a "compiled" serialization format. – pst Mar 29 at 4:18 2 Definitely true that. Unless you truly think in binary like our new robot overlords.

– squawknull Mar 29 at 4:19 1 There is an editor for ProtocolBuffers binary files: code.google. Com/p/protobufeditor . – Bruce Martin Mar 30 at 22:12 That's kind of awesome.

– squawknull Apr 1 at 2:24.

I agree with squaknull. I just wanted to add my two cents. If you are already using JSON, ask yourself: Is performance a problem now or a foreseeable problem in the future?

If so, than defiantly consider PB. All benchmarks I have seen show anywhere from slightly better to much better performance depending on the exact criteria and context. For size: I think PB should be smaller than equivalent JSON ease of conversion: PB requires use of some tools that you might have to learn to use and some (relatively small) libraries to add to your app, but both PB and JSON are meant to be usable.

How hard it will be to convert; that really depends on your own Knowledge. I think PB in general requires a bit less actual lines of code to get it working though. If performance is not currently a problem, I would suggest making a test app with PB to see if its something you want to use in the future.It certainly won't hurt to learn to use it.

Squaknull I'm wondering how much of an advantage the human readability is. The . Proto file is pretty readable.

Why would I care to read the exact data being passed? I'm not knocking your response. I'm also trying to decide between the two and I was just curious.

– logicbird Mar 29 at 5:07 1 For you there may not be a huge advantage, but the guy who has to maintain the app in 10 years time will find human read ability an advantage. That said there is a viewer/editor for protocol buffers + you can protocol buffer messages to/from a JSON like Text format, So human readability should not be a real problem – Bruce Martin Mar 30 at 22:22 Thanks Bruce, that makes sense. I'm pretty sold on PB now.

I think that will offer the best solution; at least for me it will. – logicbird Mar 31 at 7:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions