Mind map
2.2.1 OCR AS Level Programming Techniques

Map content
2.2.1 OCR AS Level Programming Techniques
Programming Costructs
- Sequence
- Code is executed line-by-line, from top to bottom
- Itteration
- Code is executed while a condition is being me or for a certain amout of repeats.
- Count controlled
- When the itteration is repeated a set amount of times
- FOR loops
- When the itteration is repeated a set amount of times
- Condition controlled
- Itteration continued until a condition is met or stops being met
- WHILE loops
- Itteration continued until a condition is met or stops being met
- Count controlled
- Code is executed while a condition is being me or for a certain amout of repeats.
- Selection
- When a certain block of code is executed if a certain condition is met
- IF statements
- Can be called branching
- When a certain block of code is executed if a certain condition is met
- Sequence
Global and Local Variales
- Variables can be defined with either local or global scope
- Where scope refers to the section of code in which the variable can be accessed
- Local Variables
- They have limited scope
- Meaning they can only be accessed within the block of code in which they were defined
- If it is defined within a subroutine it can only be accessed in that subroutine
- Therefore, multiple local variables can exist with the same name without being affercted by or affecting each other
- They are deleted once the subroutine has finished meaning they use less space
- The use of local variables is considered good practice
- Because it ensures subroutines are self-contained with no danger of variables being affected by code outside
- They have limited scope
- Global Variables
- Can be accessed across the whole program
- Useful for values that need to be accessed throughout the whole program
- Any variable declared in the main body of a program are automatically declared as global
- Not recommended due to the risk of them being unintentionally overwritten and eddited
- They use more space due to them not being deleted until the program terminated
- Can be accessed across the whole program
- Variables can be defined with either local or global scope
Modularity, Functions and Procedures
- Modularity
- Modular programming is a programming technique used to split large complex tasks into smaller self-contained modules
- Is essensial to making a problem easier to understand and approach
- A modular design also makes it easier to:
- Divide tasks between a team
- Manage the development process
- Simplify the process of testing and maintenance
- As each component can be dealt with individually
- This improves the reusability of components
- As once a module had been tested it can be reused with confidence
- This improves the reusability of components
- As each component can be dealt with individually
- A modular design also makes it easier to:
- Is essensial to making a problem easier to understand and approach
- A popular technique used to modularise programs is the top-down approach
- This is where the problem is continually broken down into sub-routines
- Until each can be represented as an individual, self-contained, blackbox which performs a certain task
- These modules form blocks of code called subroutines
- Which can be either of
- Functions
- Procedures
- Which can be either of
- These modules form blocks of code called subroutines
- Until each can be represented as an individual, self-contained, blackbox which performs a certain task
- This can also be called stepwise refinement
- This is where the problem is continually broken down into sub-routines
- Modular programming is a programming technique used to split large complex tasks into smaller self-contained modules
- Procedures vs Functions
- Functions and procedures are both named blocks of code that perform a specific task
- Procedures dont have to return a value
- Whereas functions have to return a value
- Procedures can return multiple values
- Functions have to return 1 single value
- Functions usually use local variables
- But procedures are typically given data as parameters
- Parameters
- Values passed into a function
- When parameters are passed into a subroutine they can be passed by referance or by value
- By value
- When a parameter is passed by value it is treated like a local variable
- A copy of the value is passed into the subroutine and discarded at the end
- Therefore its value outside the subroutine is unaffected
- A copy of the value is passed into the subroutine and discarded at the end
- When a parameter is passed by value it is treated like a local variable
- By refrance
- When a parameter is passed by reference the subroutine is given the address of the parameter
- Therefore the value of the parameter will be updated at the given address
- When a parameter is passed by reference the subroutine is given the address of the parameter
- By value
- Parameters
- But procedures are typically given data as parameters
- Modularity
Use of an IDE
- An Integrated Development Environment or IDE
- Is a program that provides a set of tools to make it easier for programmers to write, develop, and debug
- Common features include
- Stepping
- This allows you to monitor the individual effect of a line of code
- By executing a single line at a time
- This allows you to monitor the individual effect of a line of code
- Variable watch
- Lets a programmer observe how the contents of a variable change in real time
- Sometimes used to pinpoint errors
- Lets a programmer observe how the contents of a variable change in real time
- Breakpoint
- Allows users to set a point in the program where the program will stop
- Could be condition based or at a specific line
- Allows users to set a point in the program where the program will stop
- Source Code Edditor
- Aims to make the coding process easier by
- Autocompleting words
- Indenting
- Highlighting syntax
- Auto completing brackets
- Aims to make the coding process easier by
- Debugging Tools
- Some IDEs will provide systems to check for errors
- With a guide as to where they likely occurred through line numbers and highlighting
- Some IDEs will provide systems to check for errors
- Stepping
- An Integrated Development Environment or IDE
Images and files in the map
Information
- Description
- A level Computer Science (2.2) Mind Map on 2.2.1 OCR AS Level Programming Techniques, created by thomas gibbons on 09/01/2023.
- Created by
- thomas gibbons
- Views
- 0
- Rating
