As an example, if we want to write a program that recognises multiples of 10, most students (aged 12 – 16) get quite confused. The most common suggestion would probably be to go through the set of numbers and check to see if they are equal to 10, 20, 30 etc. But of course, this is by no way the most efficient solution and would take a huge amount of time and unnecessary processing power on large sets of numbers.
Very few would step back and realise that all multiples of 10 can be recognised by dividing the test number by 10: if there is no remainder, it’s a multiple of 10, if there is a remainder, it is not a multiple of 10. Once they understand that finding the instruction in their programming language of choice, which will check for remainders, is usually quite straightforward, then use an if statement to make a decision.
The point is that with all the hype around “coding” and the debates and / or excitement about which programming language and kits to use, it is very easy to get caught up in these things, without first building a solid foundation.
That foundation needs to include a solid understanding of mathematical facts, algebra and maths-based logic. If we continue the push with computing in the curriculum as a standalone subject, with disparate taster sessions of coding in various languages distributed on the web, it isn’t going to work.
We need to put aside coding trends, stop worrying about the latest kit and start with the building blocks. Regardless of which language or platform is being used, the following steps are always necessary when writing a program:
- What do I want the software / robot / microcontroller board to do and in exactly which order?
- How would I write that in simple steps (pseudocode)?
- Which language am I using?
- What commands / instructions are available to perform the first step?
- Write / insert the instructions that I think are correct and test.
- Does it do the first thing correctly? If yes, then continue with the next step. If not, then find the problem (debug), fix it and then move on.
Once we start thinking like computer scientists - i..e. logically and mathematically, with added common sense – we can start teaching computer science.