Learning from programming

Although perceived as just geeky, programming is a fascinating activity, and there is a great deal to learn from it. Here are a couple of things:

Executable logic
The most obvious thing to learn from programming is logic, given that every program is organized as a set of instructions arranged in a logical order. Logic does have an important role in our education system, but it is usually taught through mathematics.

One difference between math and programming is that a math solution is written on a paper, and a program is given to a computer. While the paper makes no distinction between a correct and an incorrect reasoning, when a program is incorrect, the computer will just refuse to execute it, or it will not execute it as we want it to. The executability component of a program teaches us to persist refining our understanding until the reasoning is correct.

Communication
Perhaps surprisingly, programming is a communication exercise, as it consists in explaining the compiler what we would like it to do. Programming is performed via a dedicated language that both parties understand, just like regular communication.

We tend to perceive our own thoughts as being a priori correct, and when a communication problem arises our first thought is to find the fault in our communication partner. Yet, most often the solution to a communication problem can easily be found on our side, by recognizing that there can be several valid points of view.

During programming, our communication partner, the compiler, is virtually never wrong. As such, we are forced to fight our first impulse and rethink our point of view.

Reflection
What sets us apart from other species is our ability to reflect upon our own existence, and to choose to change our own behavior. Yet, most often we do not exercise this capability ourselves. Instead we limit our reasoning to solving immediate problems and we let reflection for philosophers.

If the programming language allows it, programs too can introspect themselves and they can also change themselves while they are running. In a reflective program the reflective parts are intertwined with the regular parts, and they are executed by the same machine. The exercise of building such a program makes apparent that, if the underlying machine allows it, reflection is in fact accessible to anyone that wants to use it.

Posted by Tudor Girba at 11 January 2009, 2:21 am link