Using An API Is Like A Trip To The Grocery Store.
Let me start by being clear that I'm not a Software Engineer, nor do I build APIs. I do, however, spend a lot of my days with some of the best in the business. Folks like @jayzes, @alanpeabody, @totallymike, and @holmezi build such things for @ello these days, and some people I miss like @jejacks0n, @mikepack, @rtyer, @virtualandy, @larquin, @trmbl and others used to.
API you say?
When the @ello website, iOS app, or future Android app needs to load your profile page, for example, it asks the API what to do. The app sends a request to the API for the information it needs, and gets back a response. Including things like bio information, post timestamps, references to images, post text, love counts, views counts (and much more!), this response from the server is then used to render your bio, your posts, and all the little bits that come along with it.
The grocery store?
Calling an API is very similar to what happens when you want to make a breakfast burrito. You head to the grocery store to get the ingredients, bring them back, make the burrito, and eat it. More on that later.
Why does it matter?
We've been focusing a lot of energy at Ello lately on making the most important API calls that power Ello faster, and, well, more lean. We've found that in some cases we've been asking for information that wasn't actually relevant at the time. In these cases, the API response was way slower that we wanted, resulting in slow page load times. Sometimes this slowed things down by seconds, making Ello less fun to use.
Back to that burrito.
It's time to head to the grocery store to get what we need. How about a flour tortilla, green chiles, chorizo, eggs, and some white cheese. We'll be in and out in 5 minutes, and eating our burrito in 20. But now imagine that the grocery store is set up so that in order to get the chorizo you want, you also need to buy every kind of meat in the meat aisle. Same for the cheese, the tortilla, etc. You have so many groceries that you spend all your loot , and you can barely fit them in the . It takes you 2 hours to get home, and another 2 hours to weed through all the groceries to find the tortilla, green chiles, chorizo, eggs, and cheese that you needed. You eventually make a burrito, but nobody's hungry for breakfast anymore. It's lunchtime. Even worse, you have to throw away all the rest of the groceries...you don't like that stuff. Hopefully you donate them.
Don't waste the Quinoa.
At Ello, we built our core API well over a year ago, a crazy time at Ello, and before we were really sure what we wanted out of it. We built an amazing and functional API that did all the things we eventually needed, but we didn't build it along side the apps that were going to consume it. We didn't know if we wanted breakfast burritos, avocado toast, or a quinoa salad. Those all sounded good at the time, so we built it for all of them. In the end, when we just wanted avocado toast, we also got quinoa, kale and all the burrito fixings, only to throw them away.
What are we doing about it?
First, we're finally giving it the focused time it needs. We've already done some great work in the last week to speed up profile pages, as well as comments. We're now looking at Notifications, and soon the Discover streams. While in reality it's easy with the burrito to do it right, speeding up our API is grueling, often experimental, work that requires hours and hours to shed milliseconds of load time. The folks that I listed above (and some below) are doing it tirelessly, and we all appreciate it.