top of page

8.1: Programming Principles

Exam Board:

Eduqas / WJEC

Specification:

2020 + 

Problem Solving

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 psuedocode or presented as a flowchart.

Programming Constructs

There are three constructs (ideas) of programming that most programs will contain:

Sequence

Structuring code into a logical, sequential order.

Selection

Decision making using if statements.

Iteration

Repeating code, often using for loops or while loops.

Variables

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

Constants

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.

Self-documenting Identifiers

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.

Monochrome on Transparent.png

Questo's Questions

8.1 - Programming Principles:

​

Problem Solving

1. What is meant by 'decomposition'? Why is it important? [2]

2. What does the term 'abstraction' mean? Why is it important?  [2]

3. What is pattern recognition?  [2]

4a. What is an algorithm? [1]

4b. What are the two ways of writing an algorithm?  [2]

​

Programming Constructs

1. Describe and draw a diagram for the 3 programming constructs. [6]

​

Variables

1. What is the difference between local and global variables? [4]

2. Describe two advantages of using local variables. [2]

3. Describe two advantages of using global variables. [2]

4. What is a constant? Give an example. [2]

5. Why is it important to use self-documenting identifiers when programming? [2]

6. What is a count? What is a rogue value? [2]

​

bottom of page