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.