Skip to content

Split Node examples into static and dynamic code generation examples#6431

Merged
jtattermusch merged 2 commits intogrpc:masterfrom
murgatroid99:node_protoc_examples
May 12, 2016
Merged

Split Node examples into static and dynamic code generation examples#6431
jtattermusch merged 2 commits intogrpc:masterfrom
murgatroid99:node_protoc_examples

Conversation

@murgatroid99
Copy link
Copy Markdown
Member

Now that we have two different ways of loading the information from .proto files for use in gRPC (#5418), this splits the examples to illustrate both.

@LisaFC I tried to update the documentation to match the changes, but I'm not sure about what I wrote and I could use some help. I can also easily change the directory structure I made if a different one would work better.

TRY IT!
-------

There are two variants of these examples: one with code dynamically generated at runtime using Protobuf.js and one with code statically generated using `protoc`. The examples behave identically, and either server can be used with either client.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we link to Protobuf.js, just in case the user is interested?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an additional sentence at the start here and restructure slightly:

There are two ways to generate the code needed to work with protocol buffers in Node.js - one approach uses Protobuf.js to dynamically generate the code at runtime, the other uses code statically generated using the protocol buffer compiler protoc. Because of this, there are two variants of these examples, one using dynamically generated code, one using statically generated code. The examples behave...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've put that suggested text into the README and linked Protobuf.js

@LisaFC
Copy link
Copy Markdown
Contributor

LisaFC commented May 5, 2016

Doc updates in this look good with a couple of minor tweaks.

We'll also need to make similar updates to the Overview and Node tutorial in grpc.io. I can do that if you like?

@LisaFC
Copy link
Copy Markdown
Contributor

LisaFC commented May 5, 2016

Just in terms of the tutorial, are there particular advantages and disadvantages for each approach (convenience vs. efficiency, that sort of thing?). And will we be supporting both versions as an ongoing thing?

@LisaFC
Copy link
Copy Markdown
Contributor

LisaFC commented May 5, 2016

Also this means we need to provide instructions for installing/building protoc for Node, plus getting the plugin - what does the user need to do?

@murgatroid99
Copy link
Copy Markdown
Member Author

If you could make the relevant changes to grpc.io, that would be great.

The main advantages of dynamic code generation are ease-of-use and a simpler message API. The main advantages of static code generation are type safety and a message API that is similar to the ones in other languages.

I think we want to support both options at least through the 1.0 release. @jayantkolhe Do you have an idea more specifically how long we want to support both options?

For protoc and the plugin, along with the next release we will be publishing a package in each language that contains pre-built executables for protoc and the plugin. So, in Node, getting both of those will be as simple as running npm install grpc-tools.

@LisaFC
Copy link
Copy Markdown
Contributor

LisaFC commented May 6, 2016

Docs here LGTM, I'll open a new issue for the grpc.io updates.

@LisaFC
Copy link
Copy Markdown
Contributor

LisaFC commented May 9, 2016

"For protoc and the plugin, along with the next release we will be publishing a package in each language that contains pre-built executables for protoc and the plugin. So, in Node, getting both of those will be as simple as running npm install grpc-tools."

That sounds great - should I hold off on updating grpc.io until we have that ready (I'm already not going to merge anything in until this PR is in, as I'll be pointing to the updated examples)? Or do we have interim instructions for building and installing, as in most of the other languages?

@murgatroid99
Copy link
Copy Markdown
Member Author

That release will coincide with this feature becoming available, so it is not necessary to have interim instructions.

@jtattermusch jtattermusch merged commit 677e04d into grpc:master May 12, 2016
@LisaFC
Copy link
Copy Markdown
Contributor

LisaFC commented May 24, 2016

Tutorial update is grpc/grpc.github.io#197

@lock lock bot locked as resolved and limited conversation to collaborators Jan 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants