Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Turning Off The Aesthetic Sense

by chip (Curate)
on Apr 25, 2003 at 14:39 UTC ( #253173=perlmeditation: print w/ replies, xml ) Need Help??

A long time ago in a galaxy far, far away -- well, OK, it was Florida -- I had a job that included coding in Informix 4GL. Now, Informix 4GL is not just bad. It's fricking ugly. It's a reporting system that only an Intercal programmer could love. ("Informix 4GL is not a 4G, and is barely an L." --Jon Tombs) But the task I had to accomplish was relatively simple, so I didn't expect trouble.

There was trouble.

I couldn't finish it. Every time I got started I stalled. Nothing seemed right. My boss, with whom I carpooled, was patient. Finally one evening as we were leaving work, I told him: "I figured out how to write 4GL." His reply was an immediate and heartfelt, "Thank God!"

What was the secret to writing code using a butt-ugly language? Turning off my aesthetic sense.

Usually I edit as I write: As I work, I continually look back and check over what I write for basic standards of beauty and balance; if I see ugly, I know I've missed something that I could have done better. But on that hot Florida day I figured out that some jobs are just too crufty, involve tools or interfaces that are just too ugly, or have specs so silly, that there's no apparent way to make a solution to be proud of. At times like that, the approach I endorse is:

  • Roll up your sleeves;
  • Close your eyes;
  • Hack until it works; then:
  • Walk away and never, ever look back.

So remember, when elegance is momentarily beyond your reach: There's more than one way to define "success".

    -- Chip Salzenberg, Free-Floating Agent of Chaos

Comment on Turning Off The Aesthetic Sense
Re: Turning Off The Aesthetic Sense
by VSarkiss (Monsignor) on Apr 25, 2003 at 14:54 UTC

    My usual counter to this is something along the lines of "It's a poor craftsman that blames his tools". But coincidentally, I also used Informix 4GL about ten years ago, and in this case, I agree with you. ;-)

    Sometimes you just have to hold your nose and make it work. Then derive satisfaction that you arrived at the finish line in spite of the adversity.

Re: Turning Off The Aesthetic Sense
by Mr. Muskrat (Abbot) on Apr 25, 2003 at 14:55 UTC

    I am reminded of the greek word teleios. It was used quite a bit in the New Testament. Teleios was usually translated to English as the word "perfect". Take Matthew 5:48 for example: "Be ye therefore perfect, as your heavenly Father is perfect."

    I can hear you grumbling: What does teleios have to do with anything? Simple, it means:

    1. complete, perfect, entire; of victims, without spot or blemish; but of sacrifices, performed with full rites.
    2. of animals and men; full-grown, adult; hence, perfect in his or its kind.
    3. of numbers, full, complete.
    4. of actions, ended, finished; of vows, fulfilled, accomplished.

    If a script is "finished" or "complete", then it's teleios... It's perfect!

    The definition for teleios comes from the Greek-English Lexicon.

Re: Turning Off The Aesthetic Sense
by dragonchild (Archbishop) on Apr 25, 2003 at 16:50 UTC
    Amen!

    I, too, remember coding in a less-than-elegant language called JAM. This was before my aesthetic sense was as developed, but I was furious at having to do things in ugly ways. (VBA is similar, but I count that as a language only by the loosest, Turing sense of the word.)

    What I found that helped me is the idea that every language has its own idea of what constitutes aesthetic perfection. To achieve aesthetic pleasure, one mustn't apply one's ideas of aesthetics on the language, but apply the language's idea of aesthetics. When in Rome ...

    This definitely relates to the fact that a good programmer in any language can tell what language another programmer prefers. I know I can tell a C-Perl vs. a Java-Perl vs. a *shudders* COBOL-Perl script. That's because the aesthetic is different.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Re: Turning Off The Aesthetic Sense
by Aristotle (Chancellor) on Apr 26, 2003 at 01:21 UTC
    Of course I've no idea what Informix 4GL is like, so I may be way off base - but where applicable, code generators written in something more beautiful (Perl, anyone? :)) might be worth considering as a way to sweep the ugliness under the rug. I assume it might be here, because "barely languages" tend to result in a lot of repetition if you do it "properly" without shortcut hacks, basically devolving to something assembly-ish - in that metaphor, the code generator basically does a primitive compiler's job. (See disclaimer though, might be way off base for Informix 4GL.) Whether the effort is justified depends heavily on the project's dimensions.

    Makeshifts last the longest.

      You're on the money. I didn't want to clutter the story with (more) detail, but part of my solution entailed using m4 as a primitive form of code sharing. (Yes, it was that bad.)

          -- Chip Salzenberg, Free-Floating Agent of Chaos

      ...where applicable, code generators written in something more beautiful (Perl, anyone? :)) might be worth considering as a way to sweep the ugliness under the rug.

      Damn straight. I did that once with an IVR control system called ... um ... well, I guess I've freed up those neurons (thank the gods). Anyhow, my task was originally set as "take this printed spec, and write a control script". By the time I left that job, the task had morphed into "run the XML file from which the printed spec was generated through this Perl script, then get the sysadmin to CVS the results onto the test swerver". Much pain was avoided.

      The moral of this story seems to be: if you're doing something painful on the computer, you should probably write a program to do it for you. After all, that's what programs are for.

      --
      F o x t r o t U n i f o r m
      Found a typo in this node? /msg me
      % man 3 strfry

        The moral of this story seems to be: if you're doing something painful on the computer, you should probably write a program to do it for you. After all, that's what programs are for.

        Every single program I can think of was done so that a computer could do the annoying bits and leave the fun bits to the people. Computers - the ultimate in slave labor.

        ------
        We are the carpenters and bricklayers of the Information Age.

        Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

        I shouldn't have to say this, but any code, unless otherwise stated, is untested

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://253173]
Approved by Tanalis
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2014-08-29 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (277 votes), past polls