2.3 New Flashcards
Defensive design
Approach to software development where every possible input from a user is considered
Purpose of defensive design
-to anticipate ways a user could misuse a program
-ensure the final program is robust and reliable for all users
What can developers do to anticipate errors in programs
Ensure the software has a way of dealing with the potential errors to ensure software does not crash
Examples of error in programs
-peripheral errors
-disk errors
-communication errors
-division by 0
Peripheral error
-When peripherals do not perform as intended
-eg printer runs out of paper(fix is allow user to reprinting document after refilling the paper)
Disk error
-Error that occur on a disk
-such as disk running out of space(fix=allowing user to save work on another disk)
Communication errors
Applications using online systems losing online connection to the host server(fix = automatically retry if connection resumes)
Authentication
Process of ensuring that a system is secure by asking the user to complete tasks to prove they are an authorised user of the system
Examples of authentication
-Usernames and passwords
-CAPTCHA
Input validation
Code which is used to check that an input from a user is acceptable and matches the requirements of the program
What are the 5 main categories of validation
Length check
Type check
Range check
Presence check
Format check
Type check
Checking if what is entered is a certain data type such as integers for age
Range check
Ensuring data entered falls under a particular range such as between 0-100 for age
Length check
Checks the length of a string and checks if it meets the condition
Presence check
Looks to check if any data has been entered in a field
Format check
Ensures that the data has been entered in the correct formate such as email containing @ and . symbol
Program maintainability
Ensuring programmers can easily understand what a program is doing a long time after having written it
How are programs maintained
-commenting of code: explain the purpose of each code
-white space(makes each section clear)
-indentation: show each instance of selection and iteration and make it clear which doe belongs to which clause in the program
-sensible variable names: name describes what the variable does to prevent confusion later on
-use of sub programs: make reusable sections of code which removes the need for duplicating code and also structures the code better
Purpose of testing programs
-ensure there are no errors or bugs in the code
-ensure that the code performs as it was intended
-ensure no one can gain unauthorised access to the system
-check the program solves in the initial problem and meets all requirements
Types of testing programs
Iterative testing
Final testing
Iterative testing
-each part of program is tested
-every pathway through the program is tested(if statements)
-done during development of program
-make changes and improvements while testing
Final testing
-Testing that all parts of a program work together
-checking the program against real data to ensure it meets all of the requirements
-testing program using normal, boundary and erroneous data
-done towards end of development
-can alpha testing or beta testing
How to identify syntax errors
-program will not execute when there is a syntax error (IDE provides information about the error)
How to identify logic errors
-Program runs but expected output is not produced
-check obvious areas such as logical and Boolean operators or division by 0