Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

Two languages, one product

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

55 minutes

One tap, two worlds

You tap Order on a food app. The button changes colour at once. A moment later, the app says "Order sent".

Two different programs did this. One runs on your phone. One runs on a computer far away.

They are often written in different languages. Today you learn why, and you write both.

Key words

WordWhat it meansExample
Front endThe part the user sees and touches. It runs in the browser or on the phone.buttons, forms
Back endThe part that runs on a server. It holds the rules and talks to the database.work out the price
ServerA computer that answers requests from other computers.
BrowserThe program that shows web pages, such as Chrome.
RequestA message from the front end that asks the back end to do something.
DatabaseAn organised store of data that programs can search and change.
LanguageA set of rules for writing instructions for a computer.
Data typeThe kind of value, such as a whole number or text.A price is a number
SQLThe language for asking a database for data.

The cells students fill in are left blank in this preview.

Quick check: where does it run?

Have a go

Quick check: where does it run?

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The five languages in the spec

LanguageWhere it runsOften used forGood to know
Python 3.10 or laterServerBack end, data, scriptsShort and clear code. Many libraries
JavaScriptBrowser and serverFront end, and back end with Node (JavaScript on a server)The main language every browser runs
C#Server, desktop, gamesBack end, Windows apps, Unity games (Unity is a tool for making games)Strict about data types. Made by Microsoft
PHPServerWebsites and back endsBuilt for the web. Runs a lot of older sites
SQLDatabaseAsking for and changing dataOnly for data, so you use it with another language

The cells students fill in are left blank in this preview.

Try it: a back end in Python

Code: python
def price_with_delivery(total, fee):
    return total + fee


order = [8, 3, 2]
total = sum(order)
print("Total", total)
print("To pay", price_with_delivery(total, 3))

# The server does the sums. Change the order and run again.

Try it: a front end in JavaScript

Code: web
<button id="go">Order</button>
<p id="msg">Nothing yet.</p>

Why more than one language?

data-callouts.important.label

A browser only runs JavaScript, so the front end uses it. A server can use any language. The database speaks SQL. Choose each language for the job it does best.

The lesson goes on

5 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.