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

Free lesson

OS 6.1 (6 of 10): Platforms, devices and networks

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

55 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

Your app is not alone

You build a football app. It must run on a phone. It must talk to a server far away. It must read scores from another company. It may run on a computer in the cloud, which you rent for a short time.

Real software always works with other things. This lesson shows how to join them.

Key words

WordWhat it meansExample
Existing applicationA program your software must work with.A spreadsheet, a bank system
Operating systemThe main software that runs programs and controls the hardware.Windows, Android, Linux
Cloud platformComputers you rent over the internet and pay for as you use them.AWS, Azure
Traditional platformComputers you buy and run yourself in your own building.
DriverSoftware that lets an operating system talk to one device.
NetworkComputers joined together so they can send data to each other.
ProtocolA set of rules for how two computers talk.HTTP
Infrastructure as codeServers described in a file that a tool builds.
ContainerA sealed box with a program and all it needs.

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

Cloud or traditional?

Cloud platformTraditional platform
WhereIn a data centre owned by a companyIn your own room or building
CostPay small amounts as you use itPay a lot at the start to buy machines
GrowAdd more in minutesOrder, wait, install
ControlThe company looks after the hardwareYou look after everything
Good forA new app with unknown usersData that must stay in your building

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

Check: which platform fits?

Have a go

Check: which platform fits?

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

Operating systems and devices

Your code runs on an operating system. Windows, macOS, Linux, Android and iOS do things in different ways. File paths, permissions and programs are not the same on each.

A phone has a camera, GPS (it finds where you are) and sensors (parts that measure things, such as movement). A driver lets the system use each one. To use a device, ask the operating system. Do not talk to the hardware yourself.

Working with specific devices

DeviceWhat you can useWhat to check first
PhoneCamera, GPS, touch, sensorsDid the user give permission?
LaptopKeyboard, mouse, filesWhich operating system? Which screen size?
Smart watchHeart rate, small screenIs there battery for it?
Games consoleController, TV screenDoes the maker allow your software?

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

Check: using devices

Have a go

Check: using devices

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

Ask the operating system about itself

Code: python
import os
import platform

print("System:", platform.system())
print("Separator in paths:", os.sep)
print("Joined path:", os.path.join("data", "scores.txt"))

# os.path.join uses the right separator on any system.
# That is how code works on many systems.

Make a free account to save your work and track your progress.

Talking over a network

A network joins computers. Your app sends a request. A server sends back a response.

Both sides follow a protocol, a set of rules. The web uses HTTP. Your app often talks to an existing application the same way, such as a club's ticket system.

A network can be slow or break. Good code expects this. It waits a limited time, tries again and shows a clear message.

A request over a network

sequenceDiagram
  participant App as Your app
  participant Net as Network
  participant Server as Scores server
  App->>Net: Request: latest scores
  Net->>Server: Request arrives
  Server-->>Net: Response: scores
  Net-->>App: Response arrives
  Note over App,Server: If no response comes, the app tries again or shows a message

Match the word

Have a go

Loading…

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

Infrastructure as code

Building servers by hand is slow. People make mistakes. Nobody remembers every click.

Infrastructure as code means you write the servers you want in a file. A tool reads the file and builds them. The file goes in version control (a tool that keeps every version of your files), so you can see every change. Run it twice and you get the same result.

A file that describes servers

Code: python
# This is only data. A tool reads it and makes it true.
desired = {
    "web": "small",
    "database": "large",
}

current = {"web": "small", "old-test": "small"}

for name in desired:
    if name not in current:
        print("Create", name)
for name in current:
    if name not in desired:
        print("Delete", name)

Make a free account to save your work and track your progress.

Containers in one idea

A container holds your program and everything it needs. It runs the same on your laptop and on a server.

Many containers can share one machine. Each is kept apart from the others. You will use containers in the deployment lessons.

Plan the changes a tool makes

This is how a tool for infrastructure as code works. It compares the servers you want with the servers you have. Then it lists the actions. Finish plan and summary. Press Run Tests.

Code: python
def plan(desired, current):
    # desired and current are dictionaries: server name -> size, like {"web": "small"}.
    # Give back a list of actions, as pairs, in this order:
    #   first every ("create", name)  for a name only in desired,
    #   then  every ("update", name)  for a name in both with a different size,
    #   then  every ("delete", name)  for a name only in current.
    # Inside each group, sort the names A to Z.
    return None


def summary(actions):
    # Give back text like: 1 to create, 2 to update, 0 to delete
    return None

Make a free account to save your work, or press Start lab to work through the whole lesson.

Exit quiz

Have a go

Exit quiz

5 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

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.