Exam Board:
OCR A-Level
Specification:
Computer Science H446
2.1 - Programming Techniques
Watch on YouTube:
Programming constructs
Recursion
Local & global variables
Modularity
Integrated development environment
Object-oriented programming
Programming Constructs

Sequence, iteration and branching (also called selection) are the three fundamental programming constructs used to build algorithms.
-
Sequence means that instructions run in a specific order, one after another.
-
Iteration is the repetition of a set of instructions, usually being count-controlled, such as for loops, or condition-controlled, such as while loops or do until loops.
-
Branching (selection) allows a program to choose between different actions based on a condition, using structures like if, elif, else or switch.
Recursion

Recursion is where a function calls itself to solve a problem by breaking it down into smaller, simpler versions of the same problem.
Recursion is often used for tasks that naturally fit a 'divide and conquer' structure, such as quicksort and merge sort algorithms. It is also used for depth-first tree traversals and solving mathematical problems like factorials or the Fibonacci sequence.
​
Compared to iteration, recursion can produce clearer and more elegant solutions, but it may use more memory and can be less efficient if the recursion goes too deep or lacks a proper base case (stopping condition), potentially running out of memory.
Local & Global Variables

Local variables are created inside a function or block and can only be accessed there, which makes programs safer and easier to debug because changes to the variable cannot affect other parts of the program; however, they cannot store values that need to be shared across multiple functions.
Global variables are declared outside all functions and can be accessed anywhere in the program, making them useful for storing information that many parts of the program need, but they can lead to errors if different functions accidentally change them and can make the program harder to maintain.
Modularity

Modularity is the practice of breaking a program into smaller, self-contained parts so each section can be developed, tested and understood independently.
Functions and procedures are modular units of code: a function returns a value, while a procedure performs a task without returning a value.
When data is passed into a subroutine, it can be passed by value, where a copy of the data is sent so the original cannot be changed, or passed by reference, where the subroutine receives direct access to the original data, allowing it to be modified.
Integrated Development Environment
An Integrated Development Environment (IDE) is software that provides the tools a programmer needs to write, test and debug code in one place.
It typically includes an editor for writing and formatting code, syntax highlighting to make keywords and errors easier to spot, and auto-completion to speed up coding.
For debugging, an IDE often provides error diagnostics that highlight mistakes, a run-time environment to execute the program, and tools like breakpoints and step-through execution that allow the programmer to pause the program and inspect variables to find and fix bugs more easily.

Object-Oriented Programming
Object-oriented techniques are a way of designing programs by modelling them as collections of objects, each representing something with its own data and behaviours. These objects are created from classes, which act like blueprints describing the attributes (data) and methods (actions) an object will have.
It uses key principles such as encapsulation (keeping an object’s data and methods together and protected), inheritance (allowing classes to share and reuse features) and polymorphism (enabling objects to behave differently).
These techniques make large programs easier to organise, maintain and extend by encouraging reusable, modular and well-structured code.

Questo's Key Terms
Programming Constructs: sequence, iteration, selection (branching), if / elif / else, select (switch) case
Recursion & Iteration: count-controlled loop, condition-controlled loop, recursion, base case
Variables: local variable, global variable
Modularity: function, procedure, parameter, pass by value, pass by reference
​
Integrated Development Environment (IDE)
​
Object Oriented Programming (OOP): class, object, method, attribute, inheritance, encapsulation, polymorphism
Did You Know?
Roblox Studio is a free IDE for making Roblox games using the programming language Lua. With over 70m daily Roblox players, games built in Roblox Studio can reach a larger audience than many mainstream game engines.

