Moving Beyond JSON and XML with Protocol Buffers

This course gives an introduction to how to define inter-service messages using Protocol Buffers, with details on how to integrate them into a variety of languages.
Course info
Rating
(48)
Level
Intermediate
Updated
Jul 5, 2016
Duration
2h 17m
Table of contents
Course Overview
Introduction
Defining Messages
Using Other Features
Managing Message Revisions
Working with Different Languages
Description
Course info
Rating
(48)
Level
Intermediate
Updated
Jul 5, 2016
Duration
2h 17m
Description

Today's software landscape is increasingly being defined by microservice-based architectures that rely on small applications to coordinate with each other to support the desired features. In this course, Moving Beyond JSON and XML with Protocol Buffers, you will see just how protocol buffers provide a way to enable this communication faster and more efficiently than competing protocols such as XML and JSON. First, you'll see features and practices that are available to allow messages to evolve without breaking older applications. Next, you'll be introduced to the syntax that is used to define messages to be used with Protocol Buffers. Finally, you'll be introduced protocol buffers and the advantages that they can bring to an application. By the end of this course, you'll be prepared to use protocol buffers to efficiently communicate between services while maintaining high performance levels.

About the author
About the author

Michael Van Sickle is an application architect in Akron, Ohio. He is a mechanical engineer by training and a software engineer by choice. He is passionate about learning new programming languages and user experience design.

More from the author
The Go CLI Playbook
Intermediate
2h 8m
28 Feb 2018
Intern 4: Getting Started
Beginner
2h 41m
9 Jan 2018
Object-oriented Programming with Go
Intermediate
1h 42m
11 Aug 2017
More courses by Mike Van Sickle
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Mike Van Sickle and welcome to my course Moving Beyond JSON and XML with Protocol Buffers. I'm an engineer at SitePen. Inter-application messaging have long been dominated by XML and JSON based protocols, especially when the applications needed to work in a language neutral way. Protocol buffers offer a third option to consider with the promise of decreasing message size and increasing speed, sometimes by a factor of 10 or more. This course is going to get you going with protocol buffers and show you how to integrate them into your applications, whether you're looking for an alternative to JSON for a web application or as a more efficient transport mechanism for use in your microservice based back end. Some of the major topics we'll cover include how to use protocol buffers in server to server or server to client applications, creating messages with protocol buffers, how to organize protocol buffer definition files to work together, how to safely version messages and how to get started with protocol buffers and the many languages that are supported. By the end of this course, you'll know how to work with protocol buffers and integrate them into your next application. Before beginning the course, you should be familiar with inter-service messaging patterns, such as AJAX for Client-server applications. I hope you'll join me on this journey to learn protocol buffers with the Moving Beyond JSON and XML with Protocol Buffers course at Pluralsight.

Defining Messages
Hello, and welcome back to this course where we're talking about protocol buffers as an alternative to using JSON or XML when transferring data between two applications. In the last module we really got things started by talking about the performance benefits that you can get by integrating protocol buffers into your application. In this module we're really going to start digging in and learn how to define our own messages so we can use protocol buffers for our applications. Now if I look at how a message is constructed and I paint with a very broad brush, then we're basically going to see two types of content to a message. The first type are fields, and the second type, if you forgive me for a little bit of a weak term, is everything else. Now fields are the primary thing that the message is there for, it's going to define the actual data that we're going to be sending across. There is many other features that a message can contain in order to augment or change how the message is used by its clients. Let's dig in the fields and see how they're put together.

Using Other Features
Hello and welcome back to this course where we're learning how to protocol buffers as an alternative to JSON or XML when sending data between two applications. In the last module we covered the basics of how to create messages and add them to our protocol buffer definition files. In this module we're going to cover the other features that those files can contain and how to specify them. So as we look at the content of this module, it's going to break down into four basic categories. First, we'll go over how to work with global enumerations as opposed to the nested enumerations that we used in the last module. Then we'll learn how to create multiple messages and embed them in the same protocol buffer definition file. Then we'll start to learn how to have our protocol buffer definition files work together by learning how we can import one file's contents into the another one. And finally, we'll learn another organizational concept that comes with protocol buffer definition files, and that is how to use packages in order to separate out the different message definitions into a well-organized hierarchy. So let's get started and learn how to work with global enumerations.

Managing Message Revisions
One of the biggest things that protocol buffers have to get right is the ability to define the messages that we need in order to allow our applications to efficiently communicate one another. Over the last two modules, we've talked about the tools and features that protocol buffers expose to us in order to give us that. In this module, I want to dig into how we can keep our applications fresh and working as new features and new use cases get added to our application suite, while still maintaining backward compatibility with parts of our infrastructure that we might not be able to update as new applications and features get introduced. So there are really two concepts to talk about when we talk about working with versioning with protocol buffers. The first is a concept called reserved fields and we'll dig into that and what those can do for us in order to make sure that we communicate out aspects of a message definition that should no longer be used. The other thing we have are really just the rules and recommendations that are provided. Now the rules are the things that are enforced by the compiler and recommendations are best practices that are documented on the protocol buffer site in order to help steer you away from bad practices that could cause you problems down the road. So let's start our conversation by talking about how to work with reserved fields.

Working with Different Languages
At this point in the course, we've learned everything that we need to know about protocol buffers themselves, however, not all of you are going to be working in JavaScript or Java. So in this module what we're going to do is go through the other languages that are currently supported by protocol buffers and teach you how to work with some of them and where to find information about all of them. Now I'm going to break this module down into three parts. The first thing that I want to cover are what I'm going to call the primary languages that protocol buffers are supporting and by primary languages what I mean is that you're going to find the most information about these languages and the compilers that are the most mature for them. Then I want to extend our discussion out to the supported languages. Now these are the languages that the protocol buffer compiler has built-in support for, but you might not find quite as much information about how to work with them and finally we'll talk about the other languages and these are languages that, while not directly supported by the protocol buffer compiler, do have support in one form or another. So I'm going to show you where to find information about those languages and the support that they have for protocol buffers. So let's start our discussion by learning about the primary languages that are supported.