Tuesday, July 17, 2007

Code Critique

Many years ago, I went to college with a friend who was/is Jewish. I suppose, like many people, we have the need to classify folks: African American, tall, short, fat, ugly, German, and so forth.

In this case, the religion is worth pointing out because he would, on occasion, read a book written in Hebrew. It wasn't just a religious text, but it was also a commentary on that religious text, by various Talmudic scholars over the centuries.

Recently, I was reading this, as well as the followup commentary at the bottom of the page.

Here's what I find interesting. One of the reviewers noted that critiquing code worked well for seasoned developers, and not so well for those students coming out of college.

I understand that the "real-world" is supposed to teach you something. I also understand that college doesn't always teach you real-world stuff. It's theory and all.

But computer science is a little weird. As a discipline, it is still figuring out how to do what most people do, which is program. Oddly enough, many of the older academics seem to think of programming as a throwaway thing, a mean to an end, and believe other topics to be of more fundamental interest.

It's hard to compare this to, say, learning English. You could say learning a language is more fundamental than learning a programming language. Two things most people need to master is a spoken language and mathematics (and reasoning).

Many academics feel that math and English are good enough, and don't particularly care for the programming aspects.

So imagine what they must think when the beliefs of how one should program are changing over time. The ideas that people espoused in the 80s aren't the same as the ones they mention now. For example, the Rails guys (most notably Dave Thomas) like the acronym "DRY" which means "don't repeat yourself". When people were teaching Pascal in the 80s, they probably didn't think of this, and would wonder why it's worth teaching at all.

My point (finally!) is this. If code critique is important to get hired, then why isn't it important enough to teach? Why aren't there books on the topic critiquing code? Understandably, code critique is a matter of opinion, and people disagree. That's fine. I think folks need to understand why people disagree, so they can begin to form their own opinions.

I think as the critique grows, we begin to understand the limitations of a programming language, why we do things a certain way to overcome those limitations.

If you think about it, programming languages evolve far faster than human languages. Human languages give a great deal of power to the speaker, but demands much of the listener to interpret shades of meaning. Even though programming languages are far more precise, they still don't seem to capture what we mean to say.

So I challenge those who say we need to learn to critique to start critiquing code and give their opinions. Let a thousand flowers bloom (I know, that's terribly Maoist, especially since he backed off on that opinion).

No comments: