Please enable JavaScript.
Coggle requires JavaScript to display documents.
Programming (Subprograms: (Uses:
allow production of structured code
…
Programming
Subprograms:
Uses:
- allow production of structured code
- makes programming shorter
- easier to read and test code
- shortens the development time
- makes testing easier
- makes code more readable
Types:
Function returns a value to the main program when it is called
Procedure carries out a specific task but does not return values to the main program
Parameter are where the values passed to the function from the main program are stored
What is it?: a self contained sequence of program instructions that performs a specific task. Called whenever it is needed to carry out that function. Written once.
Creation: it needs to be defined with its type and indicated where it ends, the parameters that store the values the function will use are also stated.
Variables and Constants: used to store values in algorithms and programs. Variables change where-as constants don't.
Assignment:values placed in assignment statements using the = symbol. Association of a piece of data with a variable or constant. eg. SET
Naming Conventions: must be consistent throughout the program. Camel Case uses upper and lower case characters. Snake Case uses a underscore to link words.
Identifiers: names that describe the data being stored. Cannot be the same as reserved words such as print.
Short identifiers are easier to spell correctly each time they are used.
Long identifiers are used to be more descriptive.
Operators:
Arithmetic: Perform calculations in algorithms and programs. Follows BIDMAS.
+: addition
-:subtraction
*: multiplication
/: division (decimal points)
MOD: division (with remainders)
DIV: division (whole number)
^: to the power of
Relational: used to compare different items of data
=: equal to
<>: not equal to
<: less than
<=: less than or equal to
*>: greater than
^>=: greater than or equal to
Logical: used to combine statements which can be evaluated as true or false.
And: all statements must be true for overall to be true
Or: any statement must be true for overall to be true
NOT: reverses the logical state of the other operators, both must be false for overall statement to be true
Iteration
Count controlled: used when the number of iterations is known before the loop is started.
For loops instruct the loop to be executed a set number of times.
Step can be defined so that all the number are not used.
For Each useful for traversing a string or an array
Condition controlled: used when the number of time a loop is executed is determined by a condition
While: continue while a condition remains true and stop when it becomes false
Repeat until :continue until a condition becomes true
What is it?: the process of repeating a set of instructions for a fixed number of times or until there is a desired outcome. It is executed by program constructs called loops.
Strings
String Traversal: the process of moving through a string one character at a time. Can be used to see if it contains a particular character or a group. The length of string must be found in order to create a loop to examine each characters
-
What is it?: sequence of characters that can be contain letters number or symbols.
A string literal consists of characters enclosed in quotations marks
Arrays:
Arrays:a data structure that can store multiple items of data called elements which are all of the same data type under theme identifier. They increase the efficiency of the program. The elements within an array are enclosed within square brackets and are separated by commas.
Two-Dimensional Arrays: there is a second array at each index position of a one dimensional array. This forms a matrix.
-
Validation
What is it?: process that checks that data that is input is sensible, reasonable and appropriate to be processed by the program.
Types:
Presence Check ensures that data has been entered
Range Check ensures all inputs fall into the required range
Length Check ensures that a specified number of characters has been entered
Importance ensures that the number of errors or bugs has been minimised, the program behaves as expected and all possible errors that could occur are identified and allowed for
Authentication the process of determining the identity of a user. It is usually based on a username and associated with a password, checking they exist.
Records
Tables: a collection of records, in a two dimensional array all the elements must be strings
Arrays: In records, data such as strings and integers could be combined as opposed to being the same type.
What is it?: a collection of data objects which can be different data types
In a record, each data type is called a field and when a record structure is set up in programming languages such as C, the data types of each field must be defined.
Testing and Testplans
Suitable test data:
Normal Data tests the software under normal working conditions this is a valid or in range test.
Boundary Data tests software under extreme conditions
Erroneous data tests how software will deal with incorrect inputs entered deliberately or by mistake.
Test Plans: includes data to be used, the expected results, actual results and corrective action taken
Testing: ensures that the software produces the expected results and meets the need of the user. All software should be tested. Testing should be destructive and find errors rather than just proving that it works. Often done at two points in the development:
Iterative tests carried out during development to inform of problems
Terminal Testing carried out after development and consist of Alpha testing done by developers and Beta testing done by users
Data Types: must be declared so the data is interpreted and manipulated correctly
Integer: whole number, positive or negative
Boolean: true or false
Character: Letter, number or symbol
Real: fractions and decimals