Let's start with Maths first, before getting to Coding…
When presented by your children with a Maths word problem such as:
“Bob has 7 white buttons. He has 2 fewer brown buttons than white buttons. Bob has 4 more grey buttons than brown buttons. How many buttons does Bob have in all?”
do you sometimes wonder: ‘Who cares about Bob’s buttons?’.
We often refer to these examples as problems to solve but they are not really problem solving exercises in the sense that the problem has already been solved; what the children are required to do is compute the answer.
The above problem is simply a set of algebraic expressions written in a more verbose manner than the way algebra is usually written. The four sentences in the problem above could be written as:
w = 7
b = w - 2
g = b + 4
w + b + g = ?
Clearly it is important for our children when learning Maths to be able to translate such as scenario and compute the answer. But this is not problem solving.
In fact Maths gets a bad reputation because too many people believe that Maths is about solving questions like the one above: unambiguous scenarios that always have a clear answer. Real life Maths is not like that, and the hardest and most interesting and challenging part is solving the problem not computing the answer.
Of course not all of Maths is about solving word problems like the one above, and modern methods of teaching Maths (such as Singapore Maths, to name one) focus more on the problem solving side of Maths rather than the computation of answers.
Moving on to Programming…
I could go on talking about Maths, a subject I am passionate about and that I have used/still use extensively in my life, from my degree in Maths through many years using it professionally as a research Physicist .
But we are not called MathToday. Although we need and use some Maths in our courses, at CodeToday our focus is on coding. Or programming, to use the subject’s preferred name.
The teaching of programming can also suffer from a similar misconception as with the word problems in Maths. The process in Maths is to first solve a problem (conceptually), then to phrase that solution in a way that will allow you to compute an answer using mathematical methods you have learned. (The ‘answer’ is not always a simple number in real Maths problems, but let’s not go down that route here.)
In programming we have a similar process. We start with an idea of something we want to achieve or a problem we need to solve, we then solve the problem conceptually, break it down into logical steps and only at this point do we start writing code, translating our steps from ideas written down in English (or whatever language you think in) into code written in Python (or whatever programming language you choose to write in).
Programming vs. Coding: The difference is in the thinking part
Indeed here lies the difference between the terms ‘programming’ and ‘coding’. The latter technically refers to the last part of the process: the act of writing code. Programming however refers to the whole process which includes the problem solving and planning stages. The word ‘coding’ has been used as a synonym of ‘programming’ in the context of children’s education for long enough to have become standard now. (Even we, reluctantly, use coding when we really mean programming.) When schools and other programmes teach children and teenagers programming, care must be taken to make sure that they are not just being taught ’coding’ — and I am using ‘coding’ in its more restrictive, original sense here. Too often children are taught commands and how to use them, often through overly simplified (and boring) examples in which the problem has already been solved and all they are being asked to do is write the code.
Presenting Programming as a problem solving exercise first and foremost
That’s a shame and it misses one of the most important benefits children get from learning programming: teaching them how to think and solve problems.
Here are a few examples of what a programming exercise should sound like (these are exercises we actually use in courses):
Here is the full text of Jane Austen’s Pride and Prejudice. We need to collect all the words in the book, and find how often each word appears in the text.
I would like to simulate on computer a tennis ball that falls down and bounces on the floor.
The local lottery company wants to come up with a new lottery in which the player picks two numbers randomly between 1 and 1000. If the second number is double the first, the player wins. What are the odds for this lottery?
Instead, too often we see coding being taught through a recipe-style set of steps that denies the student the opportunity to think and solve the problem before worrying about what commands and what syntax to use.
Thinking critically to solve problems is a skill that goes well beyond programming. Arguably it’s the most important skill our children will need in order to tackle the real world successfully. We teach programming to children not because we want them all to become software developers in the future but because we want them to learn how to think. Let’s make sure programming is taught in a way that does not deny students this chance to think.
Stephen Gruppetta worked as an academic research Physicist for many years using Programming and Maths as indispensable tools in his professional life. He now runs CodeToday and leads the development of the curricula and teaching methodologies as well as delivering courses himself, which he greatly enjoys.