Today, I presented a position paper entitled “Programming Can Deepen Understanding Across Disciplines”. This paper came about from several discussions: Aaron Sloman has been making similar points for a long time, and Tom Crick is a big proponent of getting Computer Science recognised as useful to other subjects. I’m not going to post the actual slides from my talk as it was mainly demos, but here is the gist of my talk.
There already exist several useful cross-disciplinary skills in schools. Some are useful transferable skills, such as the ability to construct written arguments, or skills in secondary research. Some are more specific skills that enable further learning. Reading is a very basic example, but also things like equation handling — the ability to read, understand and lightly manipulate equations. I contend that basic programming is such a skill, and what follows are some examples of how programming can be useful in other disciplines.
Computer simulations can be useful for teaching in the sciences. The PhET project has a whole collection, such as this example of wave motion in a string. That’s useful to get an understanding by playing, but the scenario is closed source (so far as I can tell), meaning you can’t see exactly how it works “under the hood”. Here is that exact same example in Greenfoot, this time with an “Open in Greenfoot” button that allows you to access the source code. Which means we can open up the source and see the precise description of the motion of each disc in the string:
double middle = (leftNeighbour.getExactY() + rightNeighbour.getExactY()) / 2; double newForce = (middle - getExactY()) * 2; movement = (newForce + movement) / (1.0 + damping);
If we taught students some basic programming, they should be able to understand that code. My contention is that students can increase their understanding of the simulation by seeing this exact description of what it is actually doing. Seeing the code allows them to map the code to the maths equations, and the maths equations to the physics theories behind this motion. Opening up the source decreases the magic of the simulation, and potentially increases understanding.
The thing with physics simulations is that it doesn’t make much sense to modify them — the laws of physics are not to be messed with! But tinkering with simulations could aid learning, too. Take this example of a biological simulation looking at natural selection. You play the predator, killing off the frogs by clicking on them. Eventually the frogs that are left will be green. You can work out why by modifying the scenario. A small change is to turn the background red, and see if the frogs end up red — they are likely to, which suggests that they end up green because you click the ones that stand out from the background.
A further investigation that actually involves modifying the code is to look at how new frogs are spawned. Currently the colour of a new frog is based on the colour of parent that it is spawning from. So what happens if you increase the mutation rate? What happens if you stop the colour of new frogs being based on their parent? These small programming tasks can enable further play with the scenario, and increase understanding: the natural selection effect on colour requires that the mutation rate not be too high, and that the colour is based on the parent frog. Without these genetic effects, you don’t see the natural selection effect on the colour. Programming allows play, which increases understanding.
The sciences are perhaps an obvious candidate for programming. But there are examples that lie further afield. I think there’s possibility in things like sociology and economics for crowd simulations, but here’s an example for a core subject: English (or whatever your native language is!), specifically: grammar. Here is a basic example of specifying a simple, restricted grammar:
noun = article >>> item article = word "the" <|> word "a" item = word "cat" <|> word "man" verb = word "fed" <|> word "ignored" simpleSentence = noun >>> verb >>> noun
So a sentence is a noun (the subject) followed by a verb, followed by a verb (the object). With these rules written as program code, we can interact with them to try out sentences, and get the machine to print out all possible sentences:
*Main> validate simpleSentence Enter sentence: The man fed the cat Valid Enter sentence: A man ignored the man Valid Enter sentence: The cat Invalid *Main> printAll simpleSentence the cat fed the cat the cat fed the man the cat fed a cat ...a man ignored a cat a man ignored a man
The cat isn’t a valid sentence because it has no verb and noun following the first noun. (I’ve chopped out some of the possible sentences, to save space.) The idea is: grammar is already a fairly precise system, so by programming it, we can see the connection, and explore what is valid grammar and what is not (at least with this simple system). Students could then extend the grammar to allow more sentences. This is quite a simple example of using the grammar but you could also build visual parse trees to see the structure of longer examples.
Perhaps the most obvious of all the examples is maths, where there are many examples of using programming to learn and apply maths. I’m collecting them over on my other blog, The Sinepost, but the point to make here is that computers allow for a practical and fun application of maths in games.
Summary and Outcome
I’ve tried to give examples of how simple programming can be useful in other subjects. Overall, I wanted to get across in the talk that computing (as embodied/represented here by programming) does have links to other subjects, and shouldn’t be seen as an isolated discipline.
That’s roughly the talk I gave earlier today. I got some discussion, but two responses stand out. One response was that essentially I was retreading ground, proposing things already discussed and tried back in the ’80s — and this later led to further discussion on how we can make sure people [i.e. like me] are aware of previous education literature to avoid education researchers duplicating effort. So: unoriginal, apparently.
The other response was that computing shouldn’t be afraid to stand as its own discipline, and shouldn’t have to scrabble for links to other disciplines. As I explained to the questioner, I feel like the CAS mission of getting computing to stand on its own is already making headway, and it’s only with that in motion that we are able to push this secondary agenda, to make people realise that computing doesn’t stand alone as a completely separate subject from the rest of the curriculum, but rather that there is common ground to be found.