S3 - Design, testing and translators (Done) Flashcards
What is structured programming ?
Involves decomposing the program that you want to write into manageable modules, each of which is then further decomposed into smaller modules and then again until each module performs a single task. Which can be coded using simple subroutines which can be referenced in the overall program.
What does documenting the interface of a program ensue ?
Listing the modules name, any inputs, processes and the output/return value.
What are the advantages of structured programming ?
Coding is easier in small chunks, each module can be written independently so many people can work on it, it’s easier to test as each module can be tested, individual modules can be edited without affecting whole program and you can reuse subroutines in future programs.
Why should you keep your program well maintained ?
Makes it easy for other people to know what’s happening, and they should be able to change parts of the source code without causing problems elsewhere.
How can you keep a program well maintained ?
Comments - to explain whats happening at key points, indentation - to separate different statements, well named variables, subroutines and parameters - making it easier to keep track of them, and try to use local variables so changing them in subroutines won’t affect other parts of the program.
What is authentication ?
Used to increase security of programs, can confirm identity of a user before they’re allowed to access certain pieces of data or features of the program.
How can you increase the security of a password based authentication system ?
Force users to use strong passwords and get them to change regularly, limit number of failed attempts before an account ban, and ask for random selection of characters from the password on each authentication.
What is input validation ?
Checking if data meets certain criteria before passing it into the program.
What are some common types of input validation ?
Range check, presence check, format check, look-up table (compares against table of accepted values) and length check.
What are the types of programming error ?
Syntax errors or logic errors.
What is a syntax error ?
When the compilers or interpreters don’t understand something you’ve typed because it doesn’t follow rules or grammar of the programming language.
What is a logic error ?
When compiler or interpreter is able to run the program but the program does something unexpected.
How can syntax errors be diagnosed ?
Using compilers and interpreters which will be unable to turn the incorrect source code into machine code so a syntax error with it’s location will be returned.
How can logical errors be diagnosed ?
Compilers and interpreters won’t pick them up - so they’re found through general use of the program and by systematically testing it using a testing plan.
What is a test plan ?
Plan to outline exactly what you’re going to test and how, should cover all possible paths of a program.
What should a good test plan contain ?
Should anticipate potential issues with the program and select appropriate test data to test for these issues.
What three categories should test data fall under ?
Normal (typical) data - likely inputs, boundary (extreme) data - values at the limit of programs ability, and erroneous data - inputs that shouldn’t be accepted.
What should a test plan table look like ?
Columns for ‘type of (test) data’, ‘test data’, ‘reason for testing’, ‘expected outcome’, ‘actual outcome’ and ‘pass or fail’.
When do you use trace tables ?
When you’ve identified there’s a logic error - helps trace values variables take through the program to pin-point where something’s gone wrong.
What are trace tables ?
Simple way to see what a piece of code is doing, and if it’s working correctly - each column in the trace table representing a variable, and each row represents the values variables take at points in the program.
What deems an algorithms efficiency ?
The amount of ‘time’ they take to complete a task - smaller the ‘time’ taken the more efficient. Also its ‘space efficiency’ - how much space in the memory it takes up.
What does the idea of ‘time’ mean in terms of an algorithms efficiency ?
Not the real-life time, things like the number of times memory was accessed, number of CPU cycles taken to execute commands or number of times a loop was executed.
What is a high level programming language ?
One which is easier for humans to write, but computers need to translate into machine code before they can read and run it - as it’s written in a language closer to what people speak/write in.
What is a low level programming language ?
Ones that are difficult for humans to read and write but easier for a computer to run - consisting of machine code and assembly languages.