[olug] need some quick help with sed

Obi-Wan obiwan at jedi.com
Mon Dec 21 22:37:40 UTC 2009


>> SUUUURE you will...  Once it's functional, you'll never touch it again,
>> because it'll be damn low on your priority list.  Code that's initially
>> ugly, poorly written, and hard to maintain will forever remain ugly,
>> poorly written, and hard to maintain.  You're far better off writing
>> it correctly the first time.
>
> i've got a bit of a compulsion.
> trust me...it won't stay that way.
> not sure how you write, but with me, it's like writing a book.
> 
> do an outline (flowchart - sometimes just in my head)
> do a rough draft (pseudo code - usually vague text files)
> write the damn thing (make it work - where i'm at now)
> proof-read (make it proper)
> 
> your general assumption that i would not follow these steps is a mystery to
> me.
> you never revise your own code?

What kind of tiny toy projects do you write?  Perhaps the fact
that it's a shell script should answer that...

I write large software packages for a living (where "large" means
1M+ lines of code).  Sysadmin is just kind of a side gig these days.
I haven't flowcharted anything since 8th grade computer class.
With projects of that scale, or even those considerably smaller,
if your first draft isn't done properly, your code will be so
convoluted that you won't be able to "revise" it later; if you
don't like how it was done, your only recourse will be to scrap
it and start over, doing it right the second time, because it's
faster to do that than to try to rewrite your bad code.  Your first
rendition ends up being a big waste of time.  Employers tend to look
down on that.

This isn't just a theory.  I've encountered more than my share of
bad code in the last 20 years.  Some of it was written with the
best of intentions of cleaning it up later, but that never happened.
The only reason the code ever gets touched again is to fix bugs
or add features, which is far more difficult to do in poorly written
code, especially if the person revising it is not the person who
wrote it.  This typically leads to much cursing and public humiliation
of the original author.

The project lifecycle is much easier for all concerned if the job is
done right the first time.

-- 
Ben "Obi-Wan" Hollingsworth                             obiwan at jedi.com
   The stuff of earth competes for the allegiance I owe only to the
     Giver of all good things, so if I stand, let me stand on the
       promise that You will pull me through.  -- Rich Mullins



More information about the OLUG mailing list