Sunday, June 21, 2009

The Coders Dilemma

Apologies from the outset. I was waylaid this weekend by a brutal combination of friends, beaches, water, and sunshine, and this is the my first chance in front of a computer since Thursday. So, I suppose my apologies aren't THAT sincere.

I make no secret of the sheer hours I spend in front of a liquid crystal display. I try and make up for this by working with a laptop under the shade of trees as often as permits. Sadly, such a situation, like uncooked meat, is rare.

While a large fraction of this time can be written off as "goofing", a plenty sizable chunk is spent knee deep in code. Codes to generate morphologies, codes to analyze the electronics of a structure, codes to simulate the life and times of an elemental particle, codes to talk to other computers, codes to talk to other codes, codes codes codes.

Writing code, good code anyway, is an art. The prose and syntax of ones functions, the choice between concise elegance or extended clear definitions, and even an individuals personal indentation architecture, these all feed into the individuality of each programmers technique. The sound of their own voice, the shape of their brush, and the colors on their pallet.

But who ever said art has to be slow and methodical. Who ever said art has to be good. Sometimes, you don't need to compose a masterpiece. Those are the times you just need to get something done, quick and dirty. And there is nothing wrong with that! Some of the my very best strokes of the keyboard have been under last minute conditions.

The problem with "shotgun" code, really, comes when you return to it. What exactly does that giant array "musfss" do anyway? Why did you name it that? Logic algorithms you might recall as being devilishly straightforward and ingenious will appear, upon reexamination by the author, hieroglyphic. My kingdom for a comment.

And there is the coders dilemma. How fast do you stroll? Slow and steady will be readable years from now, but you'll miss out on many of those wonderful moments of brilliance which always seem to lose their way if you sit down and try to explain them beforehand, even to yourself.

On a side note, happy fathers day everyone. Anybody else have a father in rehab right now? Good times.

3 comments:

  1. You live in Michigan so your first paragraph is a blatant lie. I've been there, there's no sunshine.

    ReplyDelete
  2. I definitely fall under shotgun coding. My most frequent use of a programming language is data analysis and curve fitting. I fit ~3 different equations, not simultaneously, and each time I have to rewrite most of it from scratch because I don't like the variable names I used the last time

    ReplyDelete
  3. I gotta admit, having played around with it a bit, Matlab is pretty good at shotgun coding. It's like... Matlab is a scope or something. I tend to stick to fortan for my heavy number crunching, but Matlab is great when you don't want to bother defining anything ahead of time.

    And you know the great mitten state gets about 4 weeks of sunlight a year, except it tends to happen over a period of 2 weeks. Freaking hot out there right now!

    ReplyDelete

Note: Only a member of this blog may post a comment.