Forgood.dev
weekly

Explain complex concepts like you’re 5 years old. Tools, hacks and more.

100% free. Unsubscribe anytime.

Check out a recent issue:

🍽️API explained to a 6 year-old:

№5 •
№5 •

API = Application Programming Interface. It is a way of allowing you to access the data from another application or a way of applications to communicate with each other.

Take the example of a restaurant, since it belongs to someone else and you are not allowed to go to the Kitchen therefore the menu is the API. Allows you to make an order for food.

  • You = the customer (user)
  • Menu = the front end (what you see)
  • Waiter = the API (takes requests, doesn’t cook)
  • Kitchen = the backend (where data lives)
  • Food = the data you’re trying to get

You look at the menu, tell the waiter what you want.


They take your request to the kitchen, then return with your food.


That’s how APIs work.

Think of an API like the controls to a car.

You’ve got a gas pedal to go forward, a brake pedal to stop, a steering wheel to turn, etc.
You’ve also got information about the car – how fast it’s going (speedometer), how fast the engine is turning (tachometer), how much gas is in the tank, etc.

You don’t need to know how the gas pedal makes the car go forward or the details of how the fuel tank reads its level.

In fact, the ‘under the hood’ operation varies wildly from car to car, but since the car’s interface is (roughly) the same, you can get in just about any car and drive it.

The set of controls and information is like the car’s API. “Turn this wheel to make the car go to the right. Look here to see how fast you’re going.” is like a website’s API saying, “Give me a string of text and the ID of a parent comment, and I’ll post a reply to that comment”.

This analogy also illustrates the considerations that go into staying API compatible vs breaking the API. An electric car works very differently than a gasoline car.

Gasoline cars today work very differently than gasoline cars 75 years ago.

If you were building a car from scratch today you might come up with a “better” “API” for it (e.g. hand controlled slider for accelerating rather than a foot pedal).

BUT it would be a nightmare to roll out.

No one would want a car that they have to relearn how to drive.

So you just stick with the old API (gas & brake pedals, steering wheel etc) because compatibility is a smoother transition than migrating to a new API.

Clear?

Best,

Abi