top of page

# How Coding for Children Can Help With Other Subjects School subjects are no longer taught in complete isolation from each other. In the real world, real tasks require us to use several of our skills at the same time, merging them and blending them together. Linking the various distinct subjects our children learn not only improves learning but helps children see how these subjects support each other.

So where does coding fit in to this? How does coding benefit other subjects?

Coding is primarily a problem-solving tool. It allows us to get the computer to perform tasks that are too repetitive or time-consuming for us to do by hand. This means that we can ask—and answer—questions that we wouldn't dream of trying to solve if we had to solve them manually, without computational help.

Let's have a look at a simple example. The Python code below draws a regular polygon with any given number of sides.

You can run this code by copying and pasting on our online coding platform.

``` import turtle
​
number_of_sides = 6
​
drawing_tool = turtle.Turtle()
​
for side in range(number_of_sides):
drawing_tool.forward(75)
drawing_tool.left(360 / number_of_sides)

turtle.done()
​```

From a coding point of view there are some key topics to learn and consolidate in the short and simple program above: importing modules, variables, loops and more.

But the method used to draw the polygon—a hexagon in the example above—is to recognise that there are 360º in a full revolution, and that we need to divide that into 6 equal parts so that we end up where we started after drawing 6 straight lines. This is the concept of the external angle of a polygon in geometry.

The above program could be used perfectly in a coding lesson or in a maths lesson, and indeed the distinction doesn't really need to be there. We're writing code to solve a 'problem' for us, which is to quickly and accurately draw a regular polygon.

Let's move a bit further along to higher key stages in the curriculum. I will now spare you the code so that I don't clutter this post too much, but here's the output of another Python program that simulates the mechanics of a bouncing ball.

At the most basic level, the mechanics of a bouncing ball are not that difficult to simulate:

• Make the ball move downwards by a small step every time

• Make that step a bit larger each time the ball moves down by a step—this is acceleration due to gravity.

• When the ball hits the ground, change its direction of travel.

• Also when the ball hits the ground, change its speed so that it's a small amount smaller upon hitting the ground—this is the energy loss we get from the bouncing off the ground.

• Do the same with the horizontal movement and the walls, except for the gravity bit, of course.

Showing the students the bouncing ball and then asking them to break down the problem into small steps they can start to code is both a great coding task as well as a superb physics task. Students will learn coding skills and will really understand the science behind Newtonian mechanics for a ball that falls to the ground and bounces off the ground.

A small aside: in my previous career as an academic research scientist, I often had to simulate physical processes. A bit like the bouncing ball above, but a touch more complex! I would have spent hours on hours reading the known science from books and research papers, study and understand the equations governing the particular thing I'm looking at. But it's when I had to write code to simulate the process that I truly understood what's going on. This is because when you have to write code to simulate a physical process, you have to take care of every step of the process, no matter how small.

Maths and science are subjects that ar very well suited to being explored through coding. But coding can be used in other subjects too. Here's an example that can be used when learning maps in coding—a type of data structure. The example below is a simplified version of the code for brevity.

``` import random
​
translations = {"Vache": "Cow",
"Chien": "Dog",
"Chat": "Cat",
"Cheval": "Horse",
"Canard": "Duck",
"Cochon": "Pig",
# We can add more translations here…
}
​
for question in range(10):
french_word = random.choice(list(translations.keys()))
print("\nTranslate into English:")
print("Correct\n")
else:
print("That's incorrect. The correct translation is: ")
print(translations[french_word] + "\n")
```

Once again we have a coding exercise that can be used to reinforce knowledge in another subject, and indeed to create a different and fun way of learning and practising foreign language vocabulary. The program can be made even more useful by reading the French-English word pairs directly from a spreadsheet, which means that the same program can be easily used with different sets of words, and for different languages too.

I'll finish off with one last example back from the sciences. We return to dealing with gravity, but this time by working out the force between planets and suns as the planets orbit their suns. In the example below we look at a binary star system with two planets—more fun then having a single star!

Coding is a serious academic subject in itself. But it can also be used to help explain and understand topics from other subjects. This also showcases coding at its best, similar to how it's used in the real world: as a powerful and flexible tool to solve real problems.

bottom of page