Protocol buffer

A new way of transferring data

Welcome to the developer blog community. In this blog we are going to discuss one of the revolutionize data transferring technique which is called protocol buffer so lets start the topic.

What is protocol buffer ?

According to google, Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the “old” format.

In other words, Protocol buffer is an technique of developing programs to communicate with each other. The design goals for Protocol Buffers emphasized simplicity and performance. In particular, it was designed to be smaller and faster than XML and JSON.

Supported languages

According to protocol buffer official website proto2 provides a code generator

  • C++
  • JAVA
  • PYTHON
  • C#

Note:- Where third party implementation are also available for JAVASCRIPT

proto3 provides a code generator

  •  C++
  • JAVA
  • PYTHON
  • C#
  • GO
  • RUBY
  • OBJECTIVE -C
  • JAVASCRIPT

Note : – Third party implementation are also available for other languages like C, PHP, PERL, R, RUST, SCALA, SWIFT and JULIA.

Characteristic

The characteristics of protocol buffer and others are mention below

JSON

  • Human readableness
  • Can be parsed without knowing schema in advance
  • Excellent Browser support
  • Less verbose than XML

XML

  • Human readable/editable
  • Can be parsed without knowing schema in advance
  • Standard for SOAP etc
  • Good tooling support (xsd, xslt, sax, dom, etc)
  • Pretty verbose

Protocol buffer

  • Very dense data (small output)
  • Hard to robustly decode without knowing the schema (data format is internally ambiguous, and needs schema to clarify)
  • Very fast processing
  • Not intended for human eyes (dense binary)Above we mention the characteristics of each languages

How do I start ?

It is easy to install and learn and can be use for your own purpose. Below we share a link to briefly understand the installation process for c++ and other languages.

Link:- https://github.com/protocolbuffers/protobuf

Pros and Cons

Well As you can see different-different technologies are prefer a according to their need . As we see, Protobuf is easier to bind to objects; comparing strings in JSON can be slow but JSON is useful when you want data to be human readable. If your server side application is written in JavaScript, JSON makes most sense but JSON is not designed for numbers. As JSON is textual, its integers and floats can be slow to encode and decode where as The integer should be especially fast in Protobuf and it tends to be faster at integer encoding than JSON.For double-decoding, Protobuf has been proven to be significantly faster than JSON for double decoding . JSON is unfit for float numbers).Protocol Buffers offers various advantages to JSON for services that are directly consumed by a web browser.

Source:- https://developers.google.com/protocol-buffers

Manshu Sharma

http://openinnovationslab.com/blog/?author=3

To pursue a life-long career in a computer science field that sharp my current skills and increase my strength in the Information Technology industry and to create creative products for fun and easy use.

View more posts from this author
One thought on “Protocol buffer

Leave a Reply

Your email address will not be published. Required fields are marked *