RecallStrideA BreakellSystems productTry revision

OCR J277 · Computational thinking, algorithms and programming

Defensive design revision

Design programs that check input, authenticate users and remain understandable enough to maintain safely.

OCR GCSE Computer Science · Topic 2.3.1 · By RecallStride / BreakellSystems

Try J277 revisionAll J277 topics

What to know about defensive design

Anticipate misuse and mistakes

Defensive design anticipates unexpected input, accidental errors and deliberate misuse. State valid ranges/formats and decide how a program should respond when they are not met. A helpful error message can explain what to correct without exposing private information or internal secrets.

Validation is a reasonableness check

Validation tests whether input meets stated rules: a range check restricts numeric bounds, a length check restricts size, a presence check rejects missing data and a type/format check restricts representation. Passing these checks does not prove the supplied value is true. A plausible but incorrectly typed date can pass a range rule.

Focus areas: Defensive design.

Test yourself: questions and answers

Answer each prompt from memory before opening the explanation. These 4 samples come from this topic's 8 original retrieval cards.

What does validation check?

Whether input satisfies specified rules or acceptable limits.

What is the purpose of verification?

Checking that data was entered/copied as intended, for example by comparison or double entry.

What does a range check test?

Whether a numeric value lies within specified bounds.

What does a presence check detect?

Required data that is missing or empty.

Turn this topic into a revision session

  1. Explain one idea without looking at the notes.
  2. Compare your answer with the guidance and identify the missing link.
  3. Apply it in a question or short program, then revisit it after a delay.

Free accounts choose one revision topic pack. Pro includes all 26 packs in this course and both published qualifications. Public samples and coding practice are free; PDF guides are separate purchases.

Create a free account

Specification and sources

Check the required scope against the official OCR J277 specification (PDF). RecallStride's explanations and examples are independent learning resources. See our editorial policy or report a correction, including the topic code and statement concerned.