Tuesday, June 5, 2012

What's a tractor for

Imagine that you teach someone how to drive a tractor, how to hook up a plough, and you send them out into the field.

At no point do you mention crops, seeds, harvesting, food, or seasons. You don't speak of fertiliser nor crop rotation.

When you come back the field is full of staggering, incredibly complex and mostly useless furrows.

In the same way we seem to teach people how to use polymorphism, lambda functions, inheritance, iterators, and other tools.

But somewhere along the way no one has pointed out the fact that what we are doing is trying to make it easier to write and maintain code. In addition, it would be nice if we could also make it easier to be sure the code is correct. 

It seems that we have taught the how, not the why.

In the good old days of C++ the general comment was that in your first program you learn how to overload the operators, in your second program, you learn not to.