Section 6: Design, Testing and IDEs Flashcards
What methods can be used whilst designing defensively?
1) Anticipate how users might misuse their program, then attempt to prevent it from happening.
2) Ensuring their code is well-maintained
3) Reduce the number of errors in the code through testing.
What are the two ways to prevent users from entering something you don’t want then to?
INPUT SANITISATION: removing any unwanted characters before passing data through the program.
INPUT VALIDATION: checking if data meets certain criteria before passing it into the program.
List some types of checks.
Range check - Checks the data is within a specified range.
Presence check - Check the data has actually been entered
Check digit - Checks numerical data has been entered accurately
Format check - Checks the data has the correct format
Look-up table - Checks the data against a table of acceptable values
Length check - Checks the data is the correct length
Name some ways to increase the security of a password.
1) Force users to use strong passwords and get them to change their passwords regularly.
2) Limit the number of failed authentication attempts before access to an account is lost.
3) Ask for a random selection of characters from the password on each authentication.
Why is it important to get the level of authentication right?
Too little authentication can result in people accessing other peoples accounts & too much authentication can affect a program’s functionality and put people off using it.
What is the point of a well-maintained program?
A well maintained program makes it easy for other programmers to understand what the code does. They should also be able to change arts of the source code without the risk of causing problems elsewhere in the code.
What features of code can improve maintainability of source code?
1) Comments are useful for explaining what the key features of a program do - well written and clear comments help for others to understand your programs.
2) Indentation can be used to separate different statements in a program. This allows other programmers to see the flow of the program more clearly.
3) Variables and sub programs should be named so that they refer to what they actually refer to what they are.
4) Only use global variables when necessary as they could affect the rest of your code. Variables with a local scope will only affect the sub programs that they are declared in - other programmers will know that changing these variables won’t affect other parts of the program.
Define SYNTAX ERROR:
When the compiler or interpreter doesn’t understand something you’ve typed because it doesn’t follow the rules or grammar of the programming language.
Syntax errors can be diagnosed by compilers and interpreters - they’ll be unable to turn the source code into machine code and a syntax error (with this location) will be returned.
Define LOGIC ERROR:
When the compiler or interpreter is able to run the program, but the program does something unexpected.
Logic errors are more difficult to diagnose and track down - compilers and interpreters won’t pick them up.
When should functionality testing take place?
Functionality testing shouldn’t be left until the end of the process - it’s much better to spot errors and fix them as early as possible during development of the program.
Give some examples of types of testing.
Performance test: Tests how quickly certain features run and their impact on computer resources.
Usability Test : Test how user-friendly the interface and features are
Security Test: Tests vulnerability to attacks and how securely data is stored
Load/Stress Test: Tests how it copes under extreme conditions, e.g. lots of users at the same time.
What is Final Testing?
Final testing is when the program only goes through the development cycle once. All the required features of the program are added at the same time. The program is tested against the initial requirements of the customer - if it meets them then the program is signed-off. The customer will get what they asked for but it won’t necessarily be what they really want.
What is Iterative Testing?
Iterative testing - the program will go through the development a few times. The idea is to try and get the program to match what the customer really wants. The requirements in the first cycle might only include the main features of the program. At the start of each new cycle the requirements will be adjusted.
Give some features of High-level languages.
1) One instruction of high-level code represents many instructions of machine code.
2) The same code will work for many different machines and processors.
3) The programmer can easily store data in lots of different structures (e.g. lists and arrays) without knowing about the memory structure.
4) Code is easy to read, understand and modify.
5) Must be translated into machine code before a computer is able to understand it.
6) You don’t have much control over what the CPU actually does so programs will be less memory efficient and slower.
Give some features of Low-level languages.
1) One instruction of assembly code usually only represents one instruction of machine code.
2) Usually written for one type of machine or processor and won’t work on any others
3) The programmer needs to know about the internal structure of the CPU and how it manages memory
4) Code is very difficult to read, understand and modify.
5) Commands in machine code can be executed directly without the need for a translator.
6) You control exactly what the CPU does and how it uses memory so programs will be more memory efficient and faster.