In this edition of .NET Fiddle newsletter, we will examine GraphQL, both on the server and on the client, compare it to REST and pour a 40 for my homies, the technologies, that Microsoft killed off over the years.
This newsletter was brought to you by the greatest action movie of all time “Commando (1985)”.
I remember it put some hairs on my chest, the first time I watched this movie. I just turned 7.
Plot summary: A’nold carries a tree on his shoulder. Bad guys kidnap young Alicia Milano. A’nold uses an arsenal, fit for a small country, to kill 100s of bad guys in 100 different ways. The END.
GraphQL Server does not want to be disturbed. It is DEAD tired.
GraphQL is an open-source query language for APIs developed by Facebook ̶ and released in 2015. It has been gaining in popularity and many big companies now provide GraphQL API to developers.
GraphQL improves on REST with a flexible approach to getting data from the API. With GraphQL you don’t have to do multiple requests to get all related data (for example having to get Order first and then order’s Customer) or over fetching more data than needed (for ex. having to get all the Customer’s info, when you only need Id and Name).
Here is the fiddle:
https://dotnetfiddle.net/peYZbr
that demonstrates using NuGet packages GraphQL for .NET and GraphQL.Client to
Create GraphQL schema that maps to Customers repository
Run simple and complex Queries using GraphQL syntax
Perform Create, Update, Delete actions using GraphQL mutations
GraphQL is quite different from REST API:
GraphQL has only one endpoint
GraphQL doesn’t require Http
GraphQL only supports POST and GET requests
There are also many similarities. For more information on how GraphQL compares to REST, check out this article:
https://www.imaginarycloud.com/blog/graphql-vs-rest
What a wuss, can't even carry the log without shoulder protection.
GraphQL Client eats green Berets for breakfast
Many popular APIs now offer both REST and GraphQL endpoints. Here is the fiddle that demonstrates how to use GraphQL.Client NuGet package to access Shopify GraphQL API, and how it compares to calling Shopify REST API:
https://dotnetfiddle.net/1hWjYv
Here are some observations based on the results of this fiddle:
GraphQL API is not faster than REST. Of course, this can vary for companies other than Shopify
GraphQL gets a little slower when 20 fields are requested instead of 3
First REST request is about 3X slower than the second and third requests
Microsoft Technologies Graveyard
Over the years I fell head over heels for many of the Microsoft products. I believed MS propaganda that it was the tech of the future, and that they would provide support for it forever and ever, and that we would be like two peas in a pod.
..and than Microsoft would kill those products.
Most other companies do it also (I am looking at you Google). It is just that I have been more heartbroken by daddy MS than anyone else. So here are some MS products/technologies that were the GREATEST one day, and are DEAD the next.
Codeplex
This was the MS version of GitHub before MS bought GitHub. In the beginning, it was constantly being updated and improved. Then it was less and less of a priority for MS. Updates and fixes were becoming rare. GitHub and GitLabs grew and soon became much better than Codeplex, and I guess MS decided to flip the switch at some point. Probably as they were in discussion to buy GitHub.
I still miss features like reviews and much more refined Releases. Oh well, I drink to you Codeplex.
Kinect
Kinect was an accessory for XBox 360 which would replace the regular controller by using 2 cameras to track your movement. It was released in 2010 and by end of 2012, about 24 million units have been sold. It was a huge success.
I remember playing Kinect Sports and Dance Central on Kinect. It was freaking amazing. Yes, it did have some lag, but it was easily forgotten when you were playing tennis or trying to get a dance move just right.
So guess what happened next… Go ahead and Guess. I dare you!
In 2013 MS released the latest gaming console XBox One. It had new and improved Kinect 2 built-in, which resulted in XOne costing $100 more than PS4, which ironically had more powerful hardware. They released XBox One without any killer Kinect games. If an updated version of Dance Central was included for free, it would kick major butt, and create many converts. Instead, the killer app was “voice commands” to turn on/off Xbox. Come on MS!!!!
To make a long story short, MS removed Kinect from XBox One and lowered the price to be able to compete with PS4. Nevertheless, it was too late and PS4 sold 3 times more than XOne.
I sad… I ended up buying PS4 as small revenge. Take that MS.
Windows 10 Mobile
In 2015, MS released Windows Mobile, a mobile operating system that followed Windows Phone 8.1. It had a familiar development environment, so it was great for .NET Devs. Customers who bought Lumia phones with Windows Mobile sang its praises.
tl;dr
By 2017, Microsoft started to downplay Windows 10 Mobile and support ended in 2020.
Sponsored by one and only .NET Fiddle - sandbox for .NET devs
Did you know that:
The original actor for the character of John Matrix was going to be Nick Nolte, but the part was ultimately given to Arnold Schwarzenegger instead.
Most recent posts:
What is best in life, an essay by .NET Fiddle
The main reason for using Async Await, the easiest way to read/write CSV files, and the solution to the Tower of Hanoi puzzle.
Lose weight and gain muscle by using .NET Fiddle
Deep cloning in .NET and a new way to serialize and deserialize JSON in .NET Core
If you want to unsubscribe, click on the unsubscribe link at the bottom of this email, but… YOU’LL BE BACK.