Mindmap
Producing Robust Programs
Inhalt der Mindmap
Producing Robust Programs
Validation
- Validation applies rules to inputted data. If the data does not follow the rules, it is rejected, reducing the risk that incorrectly input data may crash a program.
- A programmer can build various types of validation into a program
- Range check - the input must fall within a specified range. This is usually applied to numbers and dates, but can apply to characters. For example, when making a payment to someone, the amount to be entered might be set to be greater than zero and not greater than the funds available.
- Length check - the input must not be too long or too short. For example, a surname will require at least one letter, but is unlikely to require more than 40.
- Presence check - a data value must be entered. For example, entering a quantity when placing an order.
- Format check - the data must be in the correct format, such as entering a date in the format DD/MM/YYYY.
- Type check - the data must be of a specified data type, such as an integer when specifying a quantity.
Authentication
- Authentication is the process of a user confirming that they are who they say they are on a computer system. In a network, this is often done through inputting a username and password. For networks that require high levels of security, authentication may include other methods.
- The factors of authentication can be broken down into three main groups:
- something you are - username, bank account number, or anything that identifies the user uniquely
- something you know - password, pin, secret answer to a question
- something you have - swipe card, biometrics, any other physical identifying device
Maintainability
- The purpose of maintainability is to ensure that, over time, a program can be easily maintained.
- In both situations, the understanding of the program, how it works and the purpose of the code will be made easier if the program is written in a maintainable style. This includes using:
- comments
- sensible variable names
- indentation
Sanitisation
- The purpose of data sanitisation is to hide or protect data so it can’t be seen or disclosed.
- Input sanitisation checks data that is entered and removes anything that might be potentially dangerous. A good example of this is on a website form.
- Masking hides visible data by replacing it with something else. A good example of this is when a person enters a password.