Session 2 Slides
Session 2 · 75 minutes · slides

From a File on Your Laptop to a Page on the Internet

Browsers, the three languages of a web page, addresses, and the request–response conversation

  1. 2.1 Why architecture is a business topic
  2. 2.2 Clients, servers, and programs
  3. 2.3 A web page is three languages
  4. 2.4 The static website on your own computer
  5. 2.5 How the internet delivers a page
  6. 2.6 Front end, back end, and the limits of static
  7. 2.7 Where Python fits

Arrow keys or space to move, F for full screen. Every slide has a Book button back to the full text.

Session 2 · 2.1 Why architecture is a business topicBook ↗

Architecture is the set of decisions that are expensive to change

The person who cannot follow the conversation does not get a vote.
Session 2 · 2.2 Clients, servers, and programs · 1/2Book ↗

One computer asks, another answers

Browser Client (your laptop) Web server program Files: pages, images Server (in a data center) 1. Request: "send me the home page" 2. Response: the page's contents Millions of clients can talk to the same server. The server never starts the conversation.
The client–server model. The client always speaks first. The server waits, answers, and forgets about the client until the next request arrives.
Session 2 · 2.2 Clients, servers, and programs · 2/2Book ↗

Two things people get wrong about servers

Session 2 · 2.3 A web page is three languages · 1/3Book ↗

A web page is a plain text file

Session 2 · 2.3 A web page is three languages · 2/3Book ↗

HTML by example

<h1>Rosenthal's Bakery</h1>
<p>Fresh bread every morning since 1998.</p>
<img src="storefront.jpg" alt="Our shop">
<a href="menu.html">See the menu</a>
Session 2 · 2.3 A web page is three languages · 3/3Book ↗

Three files, one page

index.html Content and structure style.css Colors, fonts, layout app.js Behaviour and interaction Browser reads all three, builds the page What the user sees renders
Three files, one page. The browser combines structure (HTML), appearance (CSS), and behaviour (JavaScript) into the page a person sees. All three are plain text files.
Session 2 · 2.4 The static website on your own computerBook ↗

The zero-infrastructure starting point

Session 2 · 2.5 How the internet delivers a page · 1/5Book ↗

Anatomy of a URL

https://www.rosenthalsbakery.com/menu.html?lang=en Protocol how to talk: secure HTTP Domain name which server to ask (rosenthalsbakery.com is the registered name; www is a subdomain) Path which page or file on that server Query string extra details, as name=value pairs
Anatomy of a URL. Protocol, domain, path, and optional query string. The domain picks the server; the path picks the file or page on it.
Session 2 · 2.5 How the internet delivers a page · 2/5Book ↗

Finding the server: DNS

Session 2 · 2.5 How the internet delivers a page · 3/5Book ↗

The conversation: HTTP

GET /menu.html HTTP/1.1
Host: www.rosenthalsbakery.com
User-Agent: Chrome/128.0

HTTP/1.1 200 OK
Content-Type: text/html

<!DOCTYPE html> ...
Session 2 · 2.5 How the internet delivers a page · 4/5Book ↗

What happens after you press Enter

Browser DNS server Web server 1 IP address of www.rosenthalsbakery.com? 2 It is 203.0.113.7 3 GET /menu.html (sent to 203.0.113.7) 4 200 OK + the HTML of menu.html 5 GET /style.css, GET /app.js, GET /storefront.jpg … 6 200 OK for each file 7. Render the page
What happens after you press Enter. A name lookup (DNS) comes first, then one HTTP request for the page, then more requests for everything the page references. Time flows downward.
Session 2 · 2.5 How the internet delivers a page · 5/5Book ↗

HTTPS and hosting

Session 2 · 2.6 Front end, back end, and the limits of static · 1/2Book ↗

What a static site cannot do

Session 2 · 2.6 Front end, back end, and the limits of static · 2/2Book ↗

Static versus dynamic

Static website Browser Server menu.html style.css logo.png Same file for everyone, every time Dynamic website Browser Server Program (back end, e.g. Python) Database Page built for this visitor, right now
Static versus dynamic. On the left, the server only hands out stored files. On the right, a program runs for each request, consults stored data, and composes a page. Everything in Sessions 3 and 4 lives inside that right-hand box.
Session 2 · 2.7 Where Python fitsBook ↗

Python runs on the server, not in the browser

LanguageWhere it runsJob
HTML, CSSBrowserContent and appearance
JavaScriptBrowser (and servers via Node.js)Interactivity; also back ends
PythonServers and your own computerBack-end logic, data, AI, scripts
SQLDatabase serverQuestions about stored data
Swift, KotlinPhonesNative apps
Your Python skills are directly the skills of writing back ends. "What's your stack?" means "what's your architecture?"
1 / 1From a File on Your Laptop to a Page on the Internet