Thinking is the dialogue of the soul with itself.
March 2010
Su Mo Tu We Th Fr Sa
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
1 week 1 month 1 year

A long and pointless rant.

I've been challenged recently to comprehend what has become of the craft of computer programming. In my late-night sessions lately, I've been poring over source code, trying to find meaning in the Universe.
I'm coming up empty. I've read through lots of GPL source code, some of it quite good and some really embarassing offerings.

Interestingly, the quite good code tends to have certain qualities:

The code is often written in a pointer-intensive language such as C or C++ (or even asm).

The various source files rigorously follow obvious patterns, both in the application model (i.e., design patterns) and in the code itself (e.g., naming conventions).

Comments tend to be brief but helpful in code sections where the design model isn't readily obvious.

The build process tends to be very well thought-out and (most importantly) effortless to use.

There are many more qualities of quite good code that are worth mentioning--entire books are written on the subject. In the wilds of open source, there live some exemplars of quite good code: The GNU projects, the Quake III source code, the Apache httpd server.

Not surprisingly, the really embarassing code also has notable qualities:

The source is written in a high-level language such as Java or Visual Basic. Some of the most atrocious offenders were written in PHP. I wonder if it's relevant to mention that these languages are designed to mask off the details of low-level memory management and by extension, pointer arithmetic and array referencing.

Without exception, the source implements what are commonly called "anti-patterns." See the AntiPatternsCatalog of the Portland Pattern Repository if you're not familiar with the term. Some of my personal "favorites" are BigBallOfMud, RubeGoldbergMachine, and MagicContainer. Don't spend too much time at c2.com--you'll find yourself laughing out loud much too often.

The variable names tend to be "warty" and nonsensical. Comments are outdated, non-existent, or just plain wrong.

It's a rare experience that such a project can be built from source with minimal effort. It probably has something to do with the obvious lack of attention to detail.

It's sad to think that this slipshod approach appears to have become fashionable in many programming communities. Just lurk on a programming-related newsgroup for a while. After you weed out the newbies and second-year CS students looking for homework cheats, you'll find a growing contingent of minimally-informed hackers that are contributing misleading or wrong information. It's yet another symptom of the underlying question: what has become of Real Computer Programming(TM)?

I enjoy instruction that is rigorous and precise. It's so easy to introduce noise in the channel when setting out to transcribe an idea expressed in code into English. The effort is appreciated when it's congruent with the point being made.

So, after much introspection and sleep deprivation (and reading lots of really ugly code), I offer an epiphany.

Scott's Rules Of Knowing (patent pending):

• Knowing is always preferable to guessing.
• Asking is always preferable to not knowing.
• Not knowing is never wrong to admit.

By the way, I should confess that I've written my share of really embarrassing code. But it doesn't mean that I have to be satisfied with that. I guess my main point is that there is obviously a "cost of poor quality" incurred by bad code, yet it routinely finds its way into production applications. Why?
© 2006-2012 by Scott Judd. All Rights Reserved.