levo

Producing Robust Programs

Defensive design, input validation and authentication

  • 3 things to know
  • J277/02
Start revising · £5/month

Overview

Defensive design and anticipating misuse, presence, length, range, type and format checks, validation loops, verification, and authentication in a login routine.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What do presence, length, type and format checks each test?

Key term

What is input validation, and what does a range check test?

Key term

Give three ways a user might misuse a program that asks for their age.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is defensive design?

    Model answer

    Defensive design means planning a program so it copes with every likely input and with misuse. The program should keep working and stay secure.

  2. 2

    What does anticipating misuse involve?

    Model answer

    A programmer predicts how users might misuse the program, by mistake or on purpose. The code is then written to handle each case safely.

  3. 3

    Give three ways a user might misuse a program that asks for their age.

    Model answer

    A user might leave the input blank. A user might type letters such as "ten". A user might enter an impossible value such as −5 or 250.

  4. 4

    What is input validation?

    Model answer

    Input validation is an automatic check that data follows set rules before the program accepts it. Data that fails the check is rejected and the user is asked again.

  5. 5

    What does a range check test?

    Model answer

    A range check tests that a value lies between a lowest and a highest limit. An example is a percentage that must be from 0 to 100.

  6. 6

    What do a presence check and a length check test?

    Model answer

    A presence check makes sure a field has not been left empty. A length check makes sure the input has an allowed number of characters, such as at least 8.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Systems Architecture
Memory and Storage
Computer Networks, Connections and Protocols
Network Security

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A bit is the unit of data.
smallestlargestmain

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

Integer means a whole number with no fractional part.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Producing Robust Programs, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.