2.3 Producing robust programs Flashcards
What are structured diagrams?
They are diagrams showing smaller tasks in larger program
Why use structure diagrams?
- easier for programmer as they can work on sections at a time
- Improves organisation
What are the advantages of using structure diagrams?
- coding is easier as each part is simple
- easier to test individually
- easier to spot issues to fix and update them
- reuse subprograms in future
How to make the program have more maintainability?
- Comments - explain each key feature of a program
- indentation - makes control flow clearer
- variable names - should be relevant fir better understanding
- Sub Programs - Makes code more understandable as it is split up.
What is defensive design?
When programmers protect their program
How can programmers protect their code?
Predict misuse
ensure code is well maintained
reduce errors through extensive testing
What are the methods that programmers can use to protect their code?
Input validation
Authentication
What are the type of checks that input validation uses?
Range Presence Format (eg a date) length look-up table
What is input validation?
Is checking data meets criteria before passing it on
What is Authentication?
Confirms the user identity before they’re able to access certain areas of the program (passwords)
What are the common ways to increase the security on passwords?
- use strong passwords - combination of number and letters
- limit for failed authentication attempts
- ask for random selection of characters
What is syntax errors?
where the interpretor doesn’t understand something due to a grammatical mistake
What is logic errors?
Is where the program runs, but does something unexpected
What is the difficulty of diagnosing syntax errors and logical errors?
Syntax error - easy to identify as complier returns the error and location.
Logical error - harder to track as they are not picked up by compliers
What are the 2 type of testing?
iterative testing
Final (terminal) testing
What is Iterative testing?
Is testing while the programing is being developed
What is Final testing?
The program is tested at the end of the development process. The whole program is tested at the same time to check that it is working correctly.
What is a Test plan?
Outlines exactly what you are testing and how you’re intended to do that.
(A good test plan anticipates potential issues)
What are the 4 test datas?
Normal data
Boundary data
Invalid data
Erroneous data
What is normal data?
Things that a user is likely to input
What is Boundary data?
Values at the limit of what a program can handle.
What is invalid data?
Data that should be rejected
What is erroneous data?
use of incorrect data type and should be rejected
What is machine code?
0 and 1s (binary)
What is high level language?
easy for humans to understand and are programming languages such as python.
What is low level language?
Hard for humans to read nd write but are easier for the computer to run. It has machine code and assembly languages.
Comparison of high level language and low level language.
- instructions - high level has one instruction that represents many lines of machine code. Low level has one instruction is one line of machine code
- Readable - High level is easy to read and understand. low level is hard to read and understand.
- CPU internal structure - high level doesn’t need CPU internal structure knowledge. Low level has internal structure of CPU knowledge needed
- translation - high level requires translation before the computer can understand. Low level doesn’t need translation.
The difference between compliers and translators
Translates - complier uses all source code at once and creates an EXE file but translator translates and run code line by line.
Returns- complier returns list or errors for entire program but translator returns first error it finds.
speed - complier the compiling is long but runs quickly when done but translator runs slow.
What is a Integrated Development Environment?
Are pieces of software that help programmers develop a program.
What are examples of IDE’s?
Syntax Completion Run-time environment breakpoints Version control Error diagnostics stepping
What is syntax completion?
Uses Al to predict what you’re writing and gives option for completion
What is run-Time environment
Allows code to be quickly run within the IDE
What is breakpoints
Runs code until a set “breakpoint”
What is version control?
Allows you to quickly switch between versions of the programming language you are using.
What is Error diagnostics
Helps find and fix errors in a program
what is Stepping?
Runs code line by line.