Please enable JavaScript.
Coggle requires JavaScript to display documents.
Implementation (Computational Constructs) - Coggle Diagram
Implementation (Computational Constructs)
Describe and Use Parameter Passing
Parameters are items of data that can be passed from the main program to sub-programs
Formal Parameters
Formal parameters are identified in the sub-program definition
Actual Parameters
Actual parameters are data items that are passed to the sub-program
Describe and Use Local and Global Variables
Local Variables
A variable declared within a sub-program
Only recognised in the sub-program in which the variable is declared
Can only be changed by code in the sub-program in which the variable is declared
Global Variables
A variable declared as global in the main program
Can be recognised and changed by any code across the entire program
Global variables are generally not good practice because:
They can be changed by other modules using the same variable name, leading to logic errors
They become difficult to manage when more than one programmer is working on the program code
Variable Scope
The scope of a global variable is the entire program
The scope of a local variable is the sub-program in which it is declared
Describe and Use Sub-Programs
Modular programs are broken down into blocks of code called sub-programs
A sub-program is an independent block of code within the main program
Typically a sub-program carries out a specific task
Sub-programs can be designed, programmed and tested independently of each other
Different programmers can work on different sub-programs
Each sub-program begins with a declaration which includes both the sub-program name and a list of formal parameters that are being passed into the sub-program
A sub-program can be either: a function (returns a value) or a procedure (produces an effect)
Describe and Use Substrings
A substring is a string of characters that are contained within another string
Convert from Character to ASCII
Most programming languages have a predefined function which will return the ASCII code of a character
Convert from ASCII to Character
Most programming languages have a predefined function which takes an ASCII code as a parameter and returns the corresponding character
Convert Floating Point Numbers to Integers
Most programming languages have a predefined function which takes a floating point number as a parameter and returns an integer
Describe and Use the Modulus Pre-Defined Function
Most programming languages have a predefined function which calculates the modulus (the remainder of a division)
Describe and Use Sequential Text Files
A text file is a sequential file. Data is read (or written) starting at the beginning of the file
Describe and Use Sequential CSV Files
A CSV (Comma Separated Values) file is a sequential file. Data is read (or written) starting at the beginning of the file
CSV files are structured as columns and rows:
Each column is separated by a comma
Each row is separated by a line break