Programming Flashcards
What is a procedure?
A subroutine that does not return a value
What is a function?
A subroutine that return a value
How can you tell if a variable is a constant?
Named with all capital letters e.g. EMPTYSTRING
What is a local and global variable?
- A local variable is declared in a subroutine or similar
- A global variable is declared at the highest possible level in a program so that it can be used in any lower level statements
What are programming paradigms?
Approaches to programming
What are the two main paradigms in programming?
1) Functional programming
2) Imperative programming
What are the two main types of imperative programming?
1) Procedural programming
2) Object-Oriented programming
What is functional programming?
Programming that has no variables, and instead uses functions as mappings from one value to another
What is imperative programming?
Programming that has commands that the computer performs in a specific sequence
What is procedural programming?
- Programming made up of imperative commands that are run sequentially
- Uses sequence, selection and iteration
- Broken up into smaller parts or modules using subroutines
What are the main parts of the structured approach to programming?
1) Organise programs into subroutines and modules by using hierarchy charts to break a program down
2) Store data in variables and constants with meaningful identifiers
3) Program to the interface by using subroutines
4) Use local variables instead of global variables
5) Use indentation, spacing and comments
What are the advantages to using the structured approach to programming?
- Can individually test subroutines and modules
- Modules with related subroutines make it easy to navigate for developers
- Indented code is easier to read
- Comments can explain how program works to other developers
- Meaningful identifiers make it easier to follow
- Parameters and return values to pass values into and out of subroutines reduces likelihood for errors