What Is It GraphQL Used For?
  December 02, 2019

If this question ever comes up, there are two quick ways you can relay the usefulness of GraphQL to someone who’s not affiliated with the software world.

One is that it’s like Algebra. You use it way more than you’d ever know.

How many times have you heard “Why did I take Algebra? I never use it in real life.”

Wrong. You use it every day. Ever had to figure out how much gas you can get with 10 bucks? Or have a budget as you walk into to the grocery store? You’re using Algebra to calculate how much you can buy. If you have 30 bucks, bread is X, grapes is Y, and so on.

From an awareness perspective, GraphQL is similar. Tell someone non-software about GraphQL, and it begs the question, “Why do I need GraphQL? It doesn’t affect me in any way.”

Ah, but it does. It probably influences you daily. It’s what makes your phone extra appealing. Or why you can instantly summon just about any show or movie you want. Or why you can think of a song and pull it up that instant. It wasn’t so long ago we had to actually wait for these things. (It was hell.) But now, thankfully, you can access your video of, say, 2014’s Ice Bucket Challenge mid-conversation.

And that’s because of GraphQL.

Go ahead and roll through online pictures on your phone – did the app freeze? Notice how you don’t notice this anymore? It’s partly because you hold a supercomputer in the palm of your hand, but it’s also because GraphQL let’s your phone call on, and process, a prodigious amount of information in nanoseconds.

And if you think about it in that respect, it impacts all of our lives in a major way.

Like a Vending Machine

To look at it another way, courtesy of one of the Facebook developers who invented GraphQL, there’s the vending machine analogy (paraphrased):

REST is like a vending machine. You hit one button, and you get one thing. If you need four things, you have to redo the entire request process each time to get each thing. Grab a quarter. Put it in the slot. Wait for it to go through. Hit the buttons. Watch your single item come out. Let it land. Then start again.

With a GraphQL vending machine – metaphorically speaking – you hit a certain combination of buttons and get exactly what you want in one command. BEEP BOP BOOP. 2 Peanut butter cups, 4 Snickers, M&Ms, peanuts and gum. One query. Nine items.

And that, multiplied by thousands, gives you an idea of why GraphQL is such a steppingstone for faster software.