Eduqas / WJEC
There are four stages to computational thinking (smart problem solving).
Decomposition is when you break a problem down into smaller tasks so that it is easier to solve.
Pattern Recognition is the process of identifying similar patterns within a problem.
Abstraction is when you ignore unnecessary information and focus only on the important facts.
Algorithms are the final stage as step-by-step rules are created to solve the problem. An algorithm is usually written as psuedo-code or presented as a flowchart.
There are three constructs (ideas) of programming that most programs will contain:
Structuring code into a logical, sequential order.
Decision making using if statements.
Repeating code using for or while loops.
Large programs are often modular - split into subroutines with each subroutine having a dedicated purpose.
Local variables are declared within a specific subroutine and can only be used within that subroutine.
Global variables can be used at any point within the whole program.
Local variable advantages
Saves memory - only uses memory when that local variable is needed - global variables use memory whether they are used or not.
Easier to debug local variables as they can only be changed within one subroutine.
You can reuse subroutines with local variables in other programs.
Global variable advantages
Variables can be used anywhere in the whole program (and in multiple subroutines).
Makes maintenance easier as they are only declared once.
Can be used for constants - values that remain the same.
Local & Global Variables
Variable Scope & Lifetime
The scope of a variable refers to the parts of the program where the variable can be viewed and used, e.g. a variable with global scope can be accessed anywhere in the program.
The lifetime of a variable is the amount of time the variable is stored in memory and therefore can be used, e.g. local variables can only be accessed throughout the subroutine they are created in.
A variable is data that can change in value as a program is being run.
A constant is data that does not change in value as the program is run - it is fixed and remains the same.
An example of a constant in maths programs is pi - it will constantly remain at 3.14159 and never change.
Counts & Rogue Values
When using iteration (looping) the loop must eventually be able to stop. A count is a variable that is used to record the current iteration (loop number).
A rogue value is an unexpected value that will cause the loop to end. For example by typing "Stop" into a loop that asks for numbers.
An efficient program will use variables with sensible names that immediately state their purpose in the program.
Using variable names like 'TotalNum' and 'Profit' rather than 'num1' and 'num2' mean that other programmers will be able to work out the purpose of the code without the need for extensive comments.
Object-Oriented Programming (OOP)
Java is an example of object-oriented programming (OOP) where a programmer is able to code objects that can be visually placed onto a background. Greenfoot is an IDE for Java that you should recognise and must be able to code in.
You need to know some OOP keywords and be able to recognise them.
A class from which other 'subclasses' will inherit characteristics; e.g. hippos, crocodiles and polar bears will inherit properties from the Animals superclass.
A single object from a class; e.g. one crocodile object from the Crocodile class.
A set of objects which share the same properties; e.g. all PolarBears will behave in a similar way.
Two / symbols will allow you to write a comment to explain the code.
A series of instructions that an object will follow. The act() method will loop in Greenfoot when the play button is pressed.
1. What is meant by 'decomposition'? Why is it important? 
2. What does the term 'abstraction' mean? Why is it important? 
3. What is pattern recognition? 
4a. What is an algorithm? 
4b. What are the two ways of writing an algorithm? 
1. Describe and draw a diagram for the 3 programming constructs. 
1. What is the difference between local and global variables? 
2. Describe two advantages of using local variables. 
3. Describe two advantages of using global variables. 
4. What is a constant? Give an example. 
5. Why is it important to use self-documenting identifiers when programming? 
6. What is a count? What is a rogue value? 
7. Explain what is meant by the scope and lifetime of a variable. 
Object Oriented Programming
1. Describe each of the following object oriented programming (OOP) key terms:
a. Class 
b. Superclass 
c. Object 
d. Method