2.3.2

Defensive Design Considerations 2

Test yourself

Authentication and Contingencies

Two very important elements of defensive design are authentication and contingency planning.

Illustrative background for AuthenticationIllustrative background for Authentication ?? "content

Authentication

  • Authentication is the process of checking that a person or system is authorised to use a system.
  • The most common form of authentication is to require users to enter a username and password.
  • Once a user has authenticated themselves, they should be able to see data relevant to themselves and no one else.
Illustrative background for Contingency planningIllustrative background for Contingency planning ?? "content

Contingency planning

  • It is impossible to predict all possible cases of misuse, but there are ways to help reduce errors. For example:
    • Providing helpful prompt messages.
    • Providing error-recovery routes (e.g. an undo feature).
    • Preventing access from certain parts of the system.
    • Using exception handling.

Exceptions

Rather than leaving the program to crash when an error happens, exceptions give us a chance to handle the error more gracefully.

Illustrative background for ExceptionsIllustrative background for Exceptions ?? "content

Exceptions

  • When an error arises in a program, the program is said to 'throw' an exception.
  • An exception is a description of the error that arose.
  • Exceptions can be 'caught' or handled rather than allowing the program to crash.
Illustrative background for Handling exceptionsIllustrative background for Handling exceptions ?? "content

Handling exceptions

  • If an exception can be dealt with internally, then we can catch the exception and continue with the program.
  • This is done using a structure as below:
    • try: ---
    • except: ---
  • The code within the try block will be executed.
    • If an exception is thrown inside the try block, then the except block will be run to 'clean up' after the exception.

Jump to other topics

1Computer Systems

1.1Systems Architecture

1.2Memory & Storage

1.3Computer Networks, Connections & Protocols

1.4Network Security

1.5Systems Software

1.6Ethical, Legal, Cultural & Environmental Concern

2Computational Thinking, Algorithms and Programming

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson