<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ketan Parmar</title>
    <description>The latest articles on DEV Community by Ketan Parmar (@kpbird).</description>
    <link>https://dev.to/kpbird</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F79052%2F8b086eb9-fa9a-4d6e-9480-b9505120320c.jpg</url>
      <title>DEV Community: Ketan Parmar</title>
      <link>https://dev.to/kpbird</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kpbird"/>
    <language>en</language>
    <item>
      <title>GraphQL - TL;DR</title>
      <dc:creator>Ketan Parmar</dc:creator>
      <pubDate>Tue, 09 Feb 2021 06:29:25 +0000</pubDate>
      <link>https://dev.to/kpbird/graphql-tl-dr-2nj2</link>
      <guid>https://dev.to/kpbird/graphql-tl-dr-2nj2</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Facebook develops GraphQL in 2015. On 7 November 2018, the GraphQL project was moved from Facebook to the newly-established GraphQL Foundation.&lt;/li&gt;
&lt;li&gt;Lee Byron &lt;a href="https://leebyron.com/"&gt;https://leebyron.com/&lt;/a&gt; is co-creator of GraphQL at Facebook
&lt;/li&gt;
&lt;li&gt;GraphQL is a data query and manipulation language for APIs. It can be alternative to REST API or co-exist with REST API&lt;/li&gt;
&lt;li&gt;GraphQL is not a query language of GraphDB but you can use GraphDB with GraphQL.&lt;/li&gt;
&lt;li&gt;GraphQL is preferred when the application has multiple clients (web, mobile, IoT, CLI, etc) which can ask data based on the requirement. &lt;/li&gt;
&lt;li&gt;REST API has fixed request and response which lead to a problem of over-fetching and/or under-fetching. GraphQL solves this problem with query.&lt;/li&gt;
&lt;li&gt;GraphQL Foundation maintains specification &lt;a href="http://spec.graphql.org/"&gt;http://spec.graphql.org/&lt;/a&gt;, documentation, tools and vendor-neutral events. GraphQL Working Group (WG) manage &amp;amp; -  maintain specification. &lt;a href="https://github.com/graphql/graphql-wg"&gt;https://github.com/graphql/graphql-wg&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Scaling GraphQL is not as easy as REST APIs but there are good techniques available to solve scalability.&lt;/li&gt;
&lt;li&gt;GraphQL avoids versioning by design, It’s simple to provide backward compatibility with GrapQL compare to REST API.&lt;/li&gt;
&lt;li&gt;JSON is defacto serialization format for GraphQL but GraphQL specification doesn’t stop to use another serialization format.&lt;/li&gt;
&lt;li&gt;GraphQL has Query and Mutation. The query is used to fetching the data and mutation is used to create, update or delete data.&lt;/li&gt;
&lt;li&gt;GraphQL Client can ask anything from the defined schema &lt;a href="https://graphql.org/learn/schema/"&gt;https://graphql.org/learn/schema/&lt;/a&gt; unlike REST has fixed request and response models.&lt;/li&gt;
&lt;li&gt;GraphQL uses only HTTP POST method for everything (query and mutation).&lt;/li&gt;
&lt;li&gt;As GraphQL use the single endpoint. It’s not a straight forward way to cache data like REST API but there are many approaches to cache response. 1. Server-side caching based on a globally unique id. You can also use an HTTP cache-control header. &lt;/li&gt;
&lt;li&gt;Security of GraphQL is not very different from REST API security. You need to take care of SQL Injection, DoS attack, SSRF, CRLF etc, Read more &lt;a href="https://www.howtographql.com/advanced/4-security/"&gt;https://www.howtographql.com/advanced/4-security/&lt;/a&gt; and &lt;a href="https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html"&gt;https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GraphQL Schema supports strong type system. It supports int, float, string, boolean, ID, enum, list and object.&lt;/li&gt;
&lt;li&gt;Video tutorial for beginners - &lt;a href="https://www.youtube.com/watch?v=ed8SzALpx1Q"&gt;https://www.youtube.com/watch?v=ed8SzALpx1Q&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Popular Frameworks &amp;amp; Service Apollo (&lt;a href="https://www.apollographql.com/"&gt;https://www.apollographql.com/&lt;/a&gt;), Prisma (&lt;a href="https://github.com/prisma/prisma"&gt;https://github.com/prisma/prisma&lt;/a&gt;), express-graphql (&lt;a href="https://github.com/graphql/express-graphql"&gt;https://github.com/graphql/express-graphql&lt;/a&gt;),  Graphql (&lt;a href="https://github.com/graphql-go/graphql"&gt;https://github.com/graphql-go/graphql&lt;/a&gt;), Hasura (&lt;a href="https://hasura.io/"&gt;https://hasura.io/&lt;/a&gt;), Dgraph (&lt;a href="https://dgraph.io/"&gt;https://dgraph.io/&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;People to follow Lee Byron &lt;a href="https://twitter.com/leeb"&gt;https://twitter.com/leeb&lt;/a&gt;, Dan Schafer &lt;a href="https://twitter.com/dlschafer"&gt;https://twitter.com/dlschafer&lt;/a&gt;, Jonas Helfer &lt;a href="https://twitter.com/helferjs"&gt;https://twitter.com/helferjs&lt;/a&gt;, Nick Schrock &lt;a href="https://twitter.com/schrockn"&gt;https://twitter.com/schrockn&lt;/a&gt;, Urigo &lt;a href="https://twitter.com/UriGoldshtein"&gt;https://twitter.com/UriGoldshtein&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>grphql</category>
      <category>tldr</category>
    </item>
    <item>
      <title>ProtocolBuffers - TL;DR </title>
      <dc:creator>Ketan Parmar</dc:creator>
      <pubDate>Tue, 09 Feb 2021 06:26:15 +0000</pubDate>
      <link>https://dev.to/kpbird/protocolbuffers-tl-dr-2h7o</link>
      <guid>https://dev.to/kpbird/protocolbuffers-tl-dr-2h7o</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Protocol buffers are a language-neutral, platform-neutral extensible mechanism for serializing structured data.&lt;/li&gt;
&lt;li&gt;Protocol buffers are also known as protobuf&lt;/li&gt;
&lt;li&gt;Protocol buffers are developed by Google for internal use. It is available for the public in 2008.&lt;/li&gt;
&lt;li&gt;Protobuf is binary serialize protocol, unlike JSON and XML which are text-based human-readable protocol.&lt;/li&gt;
&lt;li&gt;It’s non-human-readable because of binary serialize.&lt;/li&gt;
&lt;li&gt;Apache Thrift, Ion, Fast Buffers, FlatBuffers, Cap’n Proto, SBE (Simple Binary Encoding) are some of the alternatives of Protocol Buffers.&lt;/li&gt;
&lt;li&gt;It emphasizes simplicity and performance&lt;/li&gt;
&lt;li&gt;The current version is 3.14.0 which was released on Nov-2020.&lt;/li&gt;
&lt;li&gt;It uses .proto file extension.&lt;/li&gt;
&lt;li&gt;It has a language specification. (&lt;a href="https://developers.google.com/protocol-buffers/docs/proto3"&gt;https://developers.google.com/protocol-buffers/docs/proto3&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;To define structure in Protocol buffers. It uses “message” keyword. A message is like a class or structure in C++ and Java.&lt;/li&gt;
&lt;li&gt;It also supports nested messages (structure) same as OOPs programming language.&lt;/li&gt;
&lt;li&gt;Protocol Buffers support C++, C#, Dart, Go, Java, Python, Ruby and other popular languages.&lt;/li&gt;
&lt;li&gt;It has double, float, int32, int 64, uint32, uint64, bool, string, bytes and many other data types. Data type also has default values like C++ or Java’s data type. - For string, the default value is the empty string, For bools, the default value is false, For numeric types, the default values is zero.&lt;/li&gt;
&lt;li&gt;Protocol buffers support enums, Map, Any and Array.&lt;/li&gt;
&lt;li&gt;Protocol buffers support optional, repeated and required field&lt;/li&gt;
&lt;li&gt;Protocol buffers message has field number, field number must be a unique number in the message. The field number is used to identify the field in message binary format. The smallest field number you can specify is 1, and the largest is 229–1, or 536,870,911. You also cannot use the numbers 19000 through 19999.
Github Repo: &lt;a href="https://github.com/protocolbuffers/protobuf"&gt;https://github.com/protocolbuffers/protobuf&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Protocol buffers come with the command-line tool &lt;code&gt;protoc&lt;/code&gt;. Protoc compiles .proto file into specific language code.&lt;/li&gt;
&lt;li&gt;Example
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Go Language output

protoc -I=$SRC_DIR — go_out=$DST_DIR $SRC_DIR/addressbook.proto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Java output
protoc -I=$SRC_DIR — java_out=$DST_DIR $SRC_DIR/addressbook.proto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Protobuf is 6 times faster than JSON (&lt;a href="https://auth0.com/blog/beating-json-performance-with-protobuf"&gt;https://auth0.com/blog/beating-json-performance-with-protobuf&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>protocolbuffers</category>
      <category>protobuf</category>
      <category>tldr</category>
    </item>
    <item>
      <title>gRPC TL;DR</title>
      <dc:creator>Ketan Parmar</dc:creator>
      <pubDate>Tue, 09 Feb 2021 06:19:27 +0000</pubDate>
      <link>https://dev.to/kpbird/grpc-tl-dr-314h</link>
      <guid>https://dev.to/kpbird/grpc-tl-dr-314h</guid>
      <description>&lt;ul&gt;
&lt;li&gt;gRPC system initially developed at Google in 2015 for internal use. It is open-sourced in 2016.&lt;/li&gt;
&lt;li&gt;gRPC is an open-source remote procedure call (RPC) framework.&lt;/li&gt;
&lt;li&gt;gRPC is used for a server to server or client to server communication.&lt;/li&gt;
&lt;li&gt;gRPC is preferred when you need low latency, highly scalable and distributed system.&lt;/li&gt;
&lt;li&gt;Most common use case of gRPC is to communication between microservices.&lt;/li&gt;
&lt;li&gt;It can also use in mobile and desktop application to communicate with Server. It is a good alternative to GraphQL and REST API if an application required speed and performance.&lt;/li&gt;
&lt;li&gt;gRPC officially supports C, C++, C#, Go, Dart, Java, Kotlin, Node.js, Objective-C, PHP, Python and Ruby.&lt;/li&gt;
&lt;li&gt;gRPC Web is a JavaScript implementation of gRPC for a web application. gRPC-Web require a special proxy, by default it uses Envoy proxy.&lt;/li&gt;
&lt;li&gt;Protobuf is default and the first implementation of data format or content type.&lt;/li&gt;
&lt;li&gt;gRPC is used by Square, Netflix, CoreOS, Docker, CockroachDB, Cisco, Juniper Networks and many organizations.&lt;/li&gt;
&lt;li&gt;gRPC use Interface Definition Language (IDL) for both service interface and structure or payload.&lt;/li&gt;
&lt;li&gt;gRPC supports unary, server streaming, client streaming, bidirectional streaming.&lt;/li&gt;
&lt;li&gt;Unary RPC is like REST API request and response.&lt;/li&gt;
&lt;li&gt;Server streaming where the client request to the server once and the server sends multiple data back to the client.&lt;/li&gt;
&lt;li&gt;Client streaming where the client sends multiple data to the server.&lt;/li&gt;
&lt;li&gt;Bidirectional streaming where the client and server both send multiple data to each other.&lt;/li&gt;
&lt;li&gt;gRPC also supports synchronous and asynchronous calls.&lt;/li&gt;
&lt;li&gt;gRPC has metadata which is similar to HTTP headers, Metadata is key-value pairs where key and value are always string type. It can also use for authentication.&lt;/li&gt;
&lt;li&gt;gRPC provides simple authentication API which allows a developer to provide necessary auth information as Credentials.&lt;/li&gt;
&lt;li&gt;It supports SSL/TLS, ALTS and Token-based authentication.&lt;/li&gt;
&lt;li&gt;gRPC has standard and rich error models. The standard model includes error code and message. Error information is available to gRPc clients in all supported languages. The rich error model is available if you're using protocol buffers as data format.&lt;/li&gt;
&lt;li&gt;gRPC+Protobuf is 7 to 10 times faster compared to REST+JSON &lt;a href="https://medium.com/@EmperorRXF/evaluating-performance-of-rest-vs-grpc-1b8bdf0b22da"&gt;https://medium.com/@EmperorRXF/evaluating-performance-of-rest-vs-grpc-1b8bdf0b22da&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Original post: &lt;a href="https://kpbird.github.io/post/2021-02-09-grpc-tldr/"&gt;https://kpbird.github.io/post/2021-02-09-grpc-tldr/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>grpc</category>
      <category>protobuf</category>
      <category>rpc</category>
    </item>
  </channel>
</rss>
