Lesson 1 of 18
3. Client and Server

The picture to keep in your head

3 min read+10 XP

Every question below is answered twice: first in the restaurant, so you can picture it, then in the system, so you know exactly how it works. Each answer ends with a memory code to lock it in.

The picture to keep in your head

You sit down in a restaurant. You read the menu, write your order on a slip, and hand it to the waiter. The waiter carries it to the kitchen, the kitchen cooks, and the waiter brings back a plate. You never walk into the kitchen. The kitchen never comes to your table unasked.

That's every web request you've ever made. Your browser or app is the customer. The server is the kitchen. The network is the waiter. The order slip is the request and the plate is the response.

Our running example: an online bookstore. You open the page for book number 42, then add it to your cart.

In the restaurantIn the system
CustomerClient (browser, mobile app, another service)
MenuThe API: everything you're allowed to ask for
Order slipHTTP request
WaiterThe network (TCP or QUIC, protected by TLS)
KitchenServer
PlateHTTP response
Restaurant's addressDomain name and IP address (Chapter 4)

the restaurant mapped to the client, the request, the network, the server and the response.

Figure: the restaurant, mapped piece by piece. The menu is the API: the customer can only order what's on it.