DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Milena Brito
Milena Brito

Posted on • Updated on

Explain like I am five: API

I had an interesting experience in an interview where the specialist asked me what I would say if I had to explain about an API to a ten years old kid.
Before that meeting, I was studying microservices and monolithic to understand Docker. The only image that I had in my head, was the whale with boxes on their heads, then you can imagine that my explanation was not good to a 10 years old kid lol. Usually I take some time to make technical things be easier to understand.

After that, I been thinking about how I would say that to a non-tech person. So, for now, I will share my vision.

Quick technical explanation: API stands for Application Programming Interface. We can simplify this saying that API is the interface of an application. It give us the possibility to request and receive a service.

So, if today I try to explain to a kid, I will say:

"Imagine that you are in your dad's phone and you open the McDonalds App. When you see the menu, you will look for food you want and pay for that, right? After that, you are asking the McDonalds to delivery your food. This is how an API works. You ask and it delivers you."

What do you think about my explanation and how can I improve my knowledge? Do share your thoughts!

Top comments (11)

Collapse
armousness profile image
Sean Williams

It's funny, what is a ten-year-old kid? A friend told me recently that her ten-year-old just finished reading The Hitchhiker's Guide to the Galaxy and was moving on to The Restaurant at the End of the Universe. So is the task to explain APIs to someone who's read Douglas Adams? I was learning programming when I was ten, so is the task to explain APIs to ten-year-old me? Were they even called APIs in 1994?

The reason this is funny to me is, these are exactly the sorts of considerations programmers should have, in asking this kind of question. In particular, I expect there are a decent number of cases where it'd be easier to explain APIs to a ten-year-old than to their parents!

Anyway, if a ten-year-old for some reason asked me what an API is, I'd first try and gauge how well they understand computers and computer programming. But I'd likely give them a decently technical explanationβ€”start with "what are procedures?" and get to "what are subprocedures?" After all, an API is really just a collection of functions and some state, and I'd want to convey to the kid what's going on with all this stuff.

But, the only reason I'd take the time to explain APIs to a kid is because it might make them interested in programming (or further an interest they already have in programming). So that's the reason I'd be pretty technical with it, since if they aren't interested in programming then it doesn't matter.

Collapse
guithomas profile image
Guilherme Thomas

I really like your take on this. I read somewhere that a six year old kid can understand the concept of death with no problems, so an API explanation sounds easy.
But still, like Ernest Rutherford said "An alleged scientific discovery has no merit unless it can be explained to a barmaid"

Collapse
srcmilena profile image
Milena Author

Beautifully said! I know some concepts in science are very complex to make it easier to understand, but I'm trying to make easier whatever I think is possible. Thank you!

Collapse
zoreankit profile image
ZoreAnkit

I feel the purpose of this sort of questions is to confirm how well you understand the concepts and how can you simplify your thoughts and ideas to other person so it's easier for them to have a grasp on it.

Collapse
armousness profile image
Sean Williams

Which only makes the question more ironic, since they're needlessly complicating things by asking it this way. You might accuse me of doing the same, but in my opinion I'm just rising to the complexity of the question. I'd give the interviewer more slack if this were any job but programming...

I mean, computers don't share our intuitions, or rather, computers don't have intuitions at all. When you're looking at code, "seeing the intention" (rather than seeing what's written) is the thing that makes debugging so difficult. Asking a question that isn't what you intended, but relying on people to fill in the details for youβ€”it feels contrary to the spirit of programming, and frankly, intellectually sloppy.

Thread Thread
srcmilena profile image
Milena Author

It was a little complicated to me since my mind was full of content... trying to make it easier to understand would be hard at that moment, so quickly and suddenly.

So I think I understand your concern about it when you say about the spirit of programming

Collapse
natescode profile image
Nathan Hedglin

I think you're defining a function or protocol more than an interface.

McDonald's drive thru speaker is one interface between the customer and the restaurant.

An interface is a connection / communication point between two systems.

A doorknob is an interface between a person and the door. You can open any door with any implementation of a doorknob.

An API or Application Programming Interface is the connection point for different software, aka applications, to communicate.

It is easy to confuse interface with protocols. Interfaces define the connection/ communication but protocols define the rules and process of communication.

McDonald's drive thru speaker is an interface
The pay window is an interface
The pickup window is an interface

The rules and process for the whole interaction, order then pay then pickup, is a protocol.

Collapse
srcmilena profile image
Milena Author

Amazing point!

Thank you for bringing this. I do agree with all that you said... good commentary! I liked how you mentioned the doorknob.

Keep it going!

Collapse
natescode profile image
Nathan Hedglin

Happy to help. I've challenging myself with these fundamental questions lately.

Collapse
ninhnd profile image
Dang Ninh

I'd use the same example but with a mention on how you don't have to go to the kitchen to make the food. You don't know how to make it in the kitchen either. You just ask and they deliver.

In some cases, there are special menu items that can only be order by specific people so you will need to prove your identity as you're asking for the food

Collapse
srcmilena profile image
Milena Author

You brought an excellent point. I like how you mentioned "you don't know how to make it in the kitchen either".

Well done, thank you

Head to your account's Settings to...

🌚 Enable dark mode
πŸ”  Change your default font
πŸ“š Adjust your experience level to see more relevant content