Fear of Imprinting

As I explained in Language Shapes Thought (February 10, 2010), object-oriented programming can hardly be praised too highly. However, the existence of such a powerful blessing has some unfortunate consequences. Like languages in which nothing can happen unless you first pay obeisance to the goddess of OO by declaring at least one class, even when you have nothing classy to say. Like profs determined to teach the first programming course from the beginning with objects. It’s this latter point that I want to talk about now.

The problem with an objects-first course is that classes and objects don’t make sense without the methods that come with the classes. And methods don’t make sense without fundamental data types, variables, expressions, and statements. In objects-first, one is trying to do everything at the same time. To avoid confusion, such a course moves very slowly. At the end everything is nominally covered. But not enough time is spent practising nested if-statements, loops, and switches. As a result, instructors in later years find that, as they express it succinctly, “students can’t program“.

Where the objects-first idea come from? The pioneers of object-oriented programming had a hard time in having their cause prevail over the entrenched way of doing things. As the pioneers huddled together after another bruising encounter with the forces of darkness they vented their frustrations as: “They don’t get it. They’ve been imprinted, like Lorenz’s goddamn ducklings!” [1] And they swore, if they would ever get hold of the virgin minds of first-term students, that these minds would be imprinted with Objects.

Fear of imprinting. Remember New Math? As I heard it, in the 1960s there was a movement to teach children the mathematics of sets before 2+2=4. Inexplicable? Not when you realize that this probably came from profs hardened by years of frustration trying to teach set theory to university students. Get the abstract stuff in before the little minds are set in concrete! If New Math comes back, and these things go in cycles, the new New Math people will have learned in the meantime that sets are a Category, and a pretty dull one at that, and the little minds will be taught first categories, then sets, then ordinal numbers, then cardinal numbers, and so on to 2+2=4.

I speak with feeling here, as I have had my share of fear of imprinting. In 1973 Bob Kowalski and I proudly presented to some of the top people in artificial intelligence research the newly invented notion of logic programming [2]. It seemed to us that a way of programming that had artificial intelligence bred in the bone should be welcomed. We thought that obtuse resistance against novelty was something to be expected in Poughkeepsie, NY, but not in artificial intelligence research. But there it was.

Accordingly, when I became involved in teaching, I pleaded earnestly for the first-year programming course to be taught in Prolog. Otherwise, I claimed, they would never get it, and this was the wave of the future! Needless to say my pleading never got anywhere.

The first shot I got at students was when teaching a fourth-year course. Imagine that, I was faced with minds warped by three years of Basic, Fortran, and Cobol. And guess what? After briefly telling them how to program in logic and why to program in logic, and after a brief episode of incredulity that I really meant this, the students decided they needed the course credit and did the assignments with a minimum of fuss. They were programming in logic.

And they had probably forgotten about the whole thing before the year was out.

This experience got me over the fear of imprinting. In retrospect, it’s all so obvious. The entrenched opinions that the pioneers were facing, were held by people over thirty. With twenty-year olds objects can wait till the end of a three-month course. If you are interested in a book for such a course, check out Elements of Programming. It covers what should come before and leaves you time to introduce objects according to your own convictions.

[1] Actually, they were goslings, according to Wikipedia “Imprinting”.

[2] That year Colmerauer and Roussel in Marseille implemented logic programming in the form of Prolog.

One Response to “Fear of Imprinting”

  1. Yigal rachman Says:

    In my long working life as a developer, I have found, to my surprise and dismay, that a majority of my programming colleagues, almost all of them computer science and software engineering grads, have failed to grasp object oriented programming, as evidenced by the code they have produced.

    These folks have studied and implemented all the rite-of-passage algorithms, done courses in lisp and compiler development, and achieved excellent GPA’s, yet seem blind to good encapsulation and abstraction once working on systems and applications in the ‘real world’.

    Having thought long and hard about this, I have come to believe that they lack a sense for the aesthetics of software design and implementation. I say this because their results speak for themselves: often buggy; difficult to understand and maintain; ugly.

    Curiously, these same people have often exhibited impeccable taste and judgement in other pursuits.

    Perhaps they do not see beauty in abstract concepts? I am still puzzled…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: