BT

Microsoft Open Sources Cross-platform Serialization Library – Bond

| by Boris Lublinsky Follow 1 Followers on Feb 03, 2015. Estimated reading time: 1 minute |

Last month Microsoft open sourced Bond, a cross-platform framework for processing schematized data. Bond supports cross-language serialization/deserialization and powerful generic mechanisms for efficiently manipulating data. The framework is broadly used at Microsoft in high-scale services. The project is currently available at GitHub under the permissive MIT license. Current version supports C++, C# and Python and is available on Linux, OS-X and Windows. The Bond compiler is written in pure Haskell.

Bond shares many similarities with other serialization systems, for example Google Protocol Buffers,  Thrift and Avro:

  • Bond messages are defined in the IDL – like language
  • It maps all Bond’s data type to the native language data types

Bond’s implementation however has one major difference: it doesn’t hard-code type mappings. It allows one to plug-in many things that aren't part of the core schema logic -whether to serialize from Bond schemas or a custom type, what the wire format is, whether to put custom metadata in the payload, and so on. For example, in C++ the defaults are STL containers like std::vector; however, a user can easily map custom types - using Python’s boost::multi index container in a generated C++ struct or mapping a uint64 schema field to a System.DateTime field in a generated C# class-. Bond generated C++ structs can also use custom allocators.

A nice comparison between Bond and Google Protocol Buffers is presented is this Stack Overflow post:

Pros:

  • Bond supports generics
  • Bond has different types to represent collections: vector<T>, map<T>, list<T>
  • Bond supports type-safe lazy deserialization (bonded<T>)
  • Bond supports multiple formats (fast binary, compact binary, XML, JSON) + marshaling and transcoding

Cons:

  • Bond doesn't support different types for fixed and variable integer encoding. In Bond, the way how integers are encoded is determined by the output format (fast or compact), but in Protocol Buffers, there are integer types that always have fixed size: fixed32 and fixed64.
  • Bond doesn't support union types (oneof in Protocol Buffers)
  • Bond doesn't have Java implementation (yet)

In addition, this announcement on Reddit has many answers about Bond’s implementation and capabilities.

Considering the current trend of growing SOA usage in the form of microservices, the issue of data marshalling/unmarshalling is becoming quite important. Bond can become a useful alternative to existing serialization systems.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Big Con by Mark N

Not supporting Java (or thus any JVM Languages) is very big Con. Not sure why anyone outside MS will care. I guess we will see.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT