Imperative Programming to Start: Please!

Imperative ProgrammingNormal people don’t even know what imperative programming is. Even most programmers are at most vaguely aware of the different classes of programming languages. But there are a lot of programming paradigms.

For example, there is logic programming, which is unlike what most people even think of as a programming language. You can get an idea about it by checking out Prolog. In it, you don’t say, “Do this, then do that.” You define relationships and then ask the system questions. It’s pretty far abstracted from what a computer is actually doing. And the same is true of the object-oriented programming paradigm. And this is why people should stay away from these kinds of paradigms when they first start coding.

My big boss sent me an article recently, 30 Years Later, QBasic Is Still the Best. In it, Nicolas Bize talks about how he introduced his son to programming with QBasic and how easily his son picked up on it. So QBasic rocks, am I right?! But he doesn’t dive into why QBasic worked so well for his son. Because the issue is not QBasic or the Basic programming language at all. The issue is that it is easiest to learn simple imperative programming languages: languages where you tell the computer, “Do this, then do that.”

The reason is that they model the natural way that we go about solving problems. Here’s an example of a bit of imperative programming that pretty much everyone has written:

IF "Man on sidewalk ahead is having angry conversation with himself"
THEN "Cross the street."

In more traditional code, it would look like this:

crossStreet = 0;
crazyBehavior = 1;

if crazyBehavior = 1
  crossStreet = 1;

In object-oriented programming, it’s far less direct. The man would be an object. One of the object’s characteristics would be crazyBehavior. The object would have functions for setting and reading crazyBehavior. There are lots of reasons why this is a better way to code. And one of those reasons is that it makes the code more abstract. But that also makes it that much more difficult for someone new to programming to learn what’s actually going on.

When I first learned to program for Microsoft Windows, it was in the imperative programming language, C. The basis of every program was running a function that returned any messages that had been sent to the program. Then, the program would loop through all the messages that it was interested in. Is the message to redraw the window? Then I’ll do that! Is the message to resize the window? Then I’ll do that! And so on.

But later, I wrote everything with C++, an object-oriented language. In that, these was no checking for messages. Instead I just wrote functions for objects to do the things that needed to be done, and all that messiness of checking messages was gone. Sure, it was still in the code somewhere. But it didn’t involve me as a programmer. And if I had never coded the old imperative programming way, I wouldn’t have had much of an idea what was really going on.

Computers are stupid. So the closer you are to how they really work, the easier it is to understand. It just so happens that the closer you are to how they really work, the more work you have to do. So there is a very good reason to program using high level abstractions. But it is no way to learn.

Yet Nicolas Bize is in the minority when it comes to programmers. If you ask most programmers what language you should learn because you are just starting out, they will usually scoff at things like Basic or Fortran or even C. Personally, I think people who want to learn programming should start with some form of simple Basic. Then they should learn assembly language or take a course in digital electronics. Then they can branch out into other languages where they can be more productive. But by that time, they will understand how computers work.

Kitty Genovese and the Myth of the 38

Kitty GenoveseKitty Genovese was the young woman who was stabbed to death in New York in 1964. She became famous in death because of reporting by The New York Times and later by Times‘ editor AM Rosenthal’s book, Thirty-Eight Witnesses: The Kitty Genovese Case. The story was that as she was attacked 38 neighbors watched and did nothing. I’ve long known that the story was largely a myth, but it was only today when I listened to CounterSpin that learned just how much of a myth it was.

The show interviewed Marcia Gallo, who last year published the book, “No One Helped”: Kitty Genovese, New York City, and the Myth of Urban Apathy. The main thing I knew about the case was that when Genovese was first attacked by Winston Moseley, a man opened his window and yelled at the perpetrator — who then ran away. It’s just that she had already been stabbed; Moseley came back later and finished her off.

What I did not know was that after Moseley first ran away, she then went around the corner and collapsed inside a vestibule where the door was locked. When Moseley again attacked and attempted to rape her, she was yelling for help, but feebly (for obvious reasons) and out of sight. A friend of her’s in the building opened his door, scaring away Moseley again. As the friend called for help, another neighbor held Genovese in her arms until the ambulance arrived. It’s actually a touching scene all around with tenderness as well as the horror of it all with neighbors trying to hold themselves together enough to be helpful. Unfortunately, Genovese died of her wounds on the way to the hospital.

All of us can get behind the idea of individuals being nice to each other. But this is a traditional conservative dodge — used effectively to limit solidarity.

So where does the this notion of 38 witnesses who did nothing come from? Well, the police. In trying to find her murderer, the police were frustrated by neighbors’ lack of interest in helping them — in many cases, refusing even to open the door. But this got morphed into the idea that there were all these people who just sat by and watched Kitty Genovese be murdered. It’s certainly true that some number of people saw or heard some part of one or the other of the attacks. But as we see: at least three of them did do something.

Kitty Genovese’s Murder as Ideological Fodder

What I got from the interview with Gallo was how the case was used for other purposes. In particular, AM Rosenthal was very interested in how individuals allow bad things to happen by not speaking up. He was particularly interested in the rise of Nazism and so on. But he also seems to have been fundamentally conservative. He did not like the social movements that were rising at the time. So he used the case (probably without knowing it) as a way of putting down social movements in the name of individuals treating each other well.

Now, all of us can get behind the idea of individuals being nice to each other. But this is a traditional conservative dodge — used effectively to limit solidarity. It is very curious in the Kitty Genovese case, however, because even had he been right, the issue wouldn’t have been the lack of one-on-one care, but the lack of social cohesion — the lack of solidarity.

Interestingly, we know Rosenthal to be conservative in a couple of ways. For one, he was very keen on the Iraq War. But the other is that he was highly homophobic and this resulted in The New York Times being slow to report on the AIDS epidemic. But Kitty Genovese was a lesbian herself. And I wonder if that fact didn’t contribute to his more easily using Kitty Genovese as simply a means to his ideological ends.


Winston Moseley was caught six days after the attack, because his neighbors turned him in for a burglary they had witnessed. This whole idea that city people lose their sense of community is just ridiculous.