A Conversation w/o GraphQl

published on: September 27th 2019

A conversation w/o GraphQl

The way most programmers are fetching your data bedazzles the mind. Imagine this. You are visiting with your new neighbors and in walks their daughter that you've never met. Being the naturally polite and engaging person that you are, you say... "Hey, my name is Super Sam, and you are?" She responds:

{

name: "Chatty Cathy",

age: 7,

employed: false,

hungry: true,

}

"Oh my, this girl sure can talk." You think to yourself. As you mull over that info, you turn to her parents and say... "How adorable, which school is she enrolled?" Mom responds:

{

school_name: "West-side elementary",

enrollment: 625,

year_opened: 1975,

is_brick: true,

}

"Damn, that apple didn't fall far..." You mistakenly voice. This scenario demonstrates exactly how most programmers still fetch data. Your browser is left with a bloated file to parse before using. This process is repeated endlessly. It is slow and demonstrably inefficient. How about this scenario:

You are visiting with your new neighbors and in walks their daughter that you've never met. Being the naturally polite and engaging person that you are, you say... "Hey, my name is Super Sam, and you are?" She responds:

{

name: "Connie Concise",

}

"What a little angel". You respond.

That is what GraphQl does. GraphQl fetches only the data that we ask for. Nothing more nothing less. This has amazing effects on performance, especially for mobile devices.

F.Y.I. Unused data doesn't just disappear into thin air. We have to purge it through garbage or it builds up, takes up memory, and slows down the user's device. This purge uses CPU power.