11 Jun
2008

Code and Sunday School

As a youngster in church, my friends and I would survive boring sermons by making a search game out of the hymn book, writing (for example) “go to page 433” on a randomly-selected page. On page 433 was inscribed “go to page 22”, and so on, thus creating links ad nauseam.

I had the unpleasant task a few years ago of maintaining a series of dBase programs that embraced this concept, and, in fact, were probably written in church. Everything in the code had a value and a meaning, both of which were subject to change as the execution transferred from module to module. A field called field25 in a record may be the business phone number, unless it contained the literal “VEN”, which meant that the business phone number could be found in the vendor profile record. Later, field25 became FirstName. Meanwhile, if the vendor profile record’s b_phone contained “Line33”, then control would pass to the 33rd line in the code. I called this application the “coat hanger” app, as it reminded me of a huge pile of coat hangers, with the objective being to keep everything straight. This app was not one to screw with, as it screwed back, sort of like playing whack-a-mole with a nest of hornets.

When I first saw the phrase “Elegant code”, I thought “Someone finally gets it.”

So, why take pride in what we do? Let me use the house I live in now, and the work that the previous owner did as an example of what not to do.

Take the laundry room. Recently, I had to remove some of the sheetrock from the wall to repair a leaking main water valve, whose duct tape finally gave out. The center studs were supported by the sheetrock. Perhaps it was to hard to find 16-penny nails, or maybe the sheetrock nails were too short to do the framing. I had never thought of hanging 2×4’s onto sheetrock, but I have seen code that was done in a similar manner. Not elegant.

Then there are the doorknobs throughout the house. Some have a rectangular flange around the latch, and some are simply a round barrel. Why not put the rectangle ones in the doors with simply round holes? After all, the hole is already there, and nobody will notice if the edge of the door doesn’t get routed out to accommodate the rectangle flange. It would be very hard to carve out with a sheetrock nail anyway. Besides, someone else will have to maintain this, not me.

Consider the outside paint job. If nobody can see the top of the window casing, why waste paint on it? Sure, there are parts of the old paint job that need to be scraped off, but new paint will work just like glue, holding the old paint in place. This must have helped to create the shortest direct route from the ladder to the hammock and lemonade.

The plumbing was cool, too. The hot and cold faucets were reversed in the two upstairs bathrooms. Perhaps the people living upstairs were left-handed, or did everything behind their backs.

It must have been out of boredom to place the light switches for the bathrooms to the right of the towel rack, three feet from the doorway. Pretty amusing for first-time visitors: “Does your bathroom have lighting?”

All in all, it seems that this guy’s cranial-rectal inversion was a manifestation of apathy and love of duct tape.

——————— By Contrast ———————

The finish carpenter on the last house that we had built took a great deal of pride in his work. When he was finished with his work on the doors, cabinets, railing, and trim, he videotaped his work. I was impressed.

I suppose that this could be considered elegant woodwork. It was done with a lot of focused energy, from selecting materials to puttying the smallest of nail holes. This guy cared about his work, and believed that what he did would make a difference. To him, it was simply the way he was; he took pride in what he did, and his work was a mirror image of his thoughts and actions.

If, as analysts and developers, we concentrate on the video tape at the end of the project, we can influence the community and make analysis and programming a better place to live.

One thought on “Code and Sunday School”

  1. One bit of incentive is knowing that your work will be publicly reviewed when it’s done, whether it’s a final walk through with the customer, source code release, or a group peer review.

    We did group peer reviews at first to get the hang of it, and once people saw their inelegant code get hit with the harsh light of the overhead projector, our quality definitely improved.

Comments are closed.