Sunday, March 8, 2009

Teaching C programming

This week I gave my C programming class an assignment in which I was able to observe their comprehension of programming in C.

The assignment was as follows: Write a program that inputs two floating-point values from the keyboard and then displays their product.

I directed them to a sample piece of code as follows:

#include
int main(void)
{
float y;
int x;
puts("Enter a float, then an int");
scanf( "%f %d", &y, &x);
printf( "\nYou entered %f and %d ", y, x);
return 0;
}

I had the students think through each line of the above code so that they understood how this is taking in 2 numbers and printing them back out.

Then I had them consider the following:

Arguments in printf () can be any valid C expression. For example, to print the sum of x and y, you could write:

total = x + y;
printf("%d", total);

You also could write

printf("%d", x + y);


With the above information, they should be able to figure out how to complete the assignment. It was interesting watching them piece together these bits of information from different locations to come up with a complete solution. The students also felt the satisfaction of figuring out the solution on their own, since I gave them hints in the right direction, but they still had to make the connections on their own.

Kant and a priori knowledge

Kant liked to talk a lot about a priori knowledge: The knowledge that you can gain without experimentation, for example "All bachelors are unmarried". He goes on in his "Critique of Pure Reason" to elaborate on all this knowledge that we can gain without experiments. Well, if you look at the above example, the knowledge that all bachelors are unmarried is just a clarification of language. By looking at the definitions of these terms: bachelor and unmarried, there a pre-defined relationship between these concepts in the English language. So then, a priori knowledge is just a fancy way for clarifying the relationships that already exists between words and concepts in a language. I really think that a priori knowledge can only exist in the context of language because a priori knowledge is really only the clever manipulation of words.

The development of a priori knowledge is also called deductive reasoning - figuring things out from pre-existing premises. Philosophers love to figure things out deductively rather than lift a finger and do an actual experiment. They do not want to "dirty" their thinking with experimentally obtained facts.

Well, my question is "what are they thinking about if they are not using experimentally obtained information". Since most of their deductive thinking is just clever manipulations of definitions of words, how can they do their deductive thinking without having first learned a language. And learning a language is done experientially. So they have to experience before they can deductively think.

I think that pure philosophy has this illusion that they can think their way to figuring out life rather than actually engaging in life and experiencing it. Because of this, they do not have a framework for combining critical deductive thinking with experientially gained information. Thus philosophers do not know how to incorporate spiritual knowledge gained through experience into their deductive reasoning processes.

Of course, the current trend in philosophy (post modernism) is to throw out the deductive reasoning and rely totally on personal experience as the only way to gain knowledge.

I think both reasoning and experience need to be valued. People need to be able to communicate their experiences in reasonable ways, and they need to temper their reasoning with experiential reality.