View Single Post
  #122   Report Post  
Tim Douglass
 
Posts: n/a
Default

On Tue, 31 May 2005 11:09:59 -0000,
(Robert Bonomi) wrote:

In article ,
Doug Miller wrote:
In article ,
(Robert Bonomi) wrote:
[long snip of interesting idea]
But trying to explain _how_ that trivial little "50*period" incantation
accomplishes that magic is *very* involved.


In similar situations, I have been known once or twice to write comments along
the lines of "Trust me: this works. If you can't figure out why, you probably
shouldn't modify it."

Those comments occasionally produced some chuckles... but never any
complaints.


I did that once. The boss spent the *entire* week-end trying to figure out
_how_ it did what it did. Including setting up a test-bed program to verify
that it really did do what I claimed.

Monday morning, I get called into his office. Whereupon he makes the request
to 'explain this thing to me', and then would I _please_ not do things like
that 'late in the week' -- that it was hard on management when they discovered
it after I was gone for the week-end.

After that, he made me write up complete comments on *how* it worked.
That was the full-page of comments for the one-line (one machine-instruction)
code.


Probably what I would have done had I been your manager. :-) When I
was actually writing code I wasn't the guy who created the ultra-cool
algorithm, I was the one who wrote some god-awful monstrosity to
accomplish the (supposedly) impossible in a ridiculously short period
of time. I always believed that anything I wanted the machine to do I
could make it do. It wasn't always pretty, but they always worked and
could always be maintained. Generally others came along and replaced
my quick and dirty with something elegant - but I got it out the door
on time.

When I moved to managing programmers I came to loathe those who wrote
"clever" algorithms. My ability to read and understand code was well
above average and anything I couldn't figure out in a reasonable
length of time with the included comments was rejected. Those who
persisted in producing those things found employment elsewhere. My
experience has been that the more clever the algorithm the more likely
it is to cause problems a couple years down the road. A good example
is undocumented truth-table algorithms - which were a favorite with
*my* boss when he wrote code (which I inherited). It wasn't hard at
all to lose a week or more just trying to add one option. As hardware
speeds increased I dumped the elegant in favor of brute force that
could be easily understood and maintained.

I always envied the algorithmic geniuses and the games they played,
but in the interests of making money for the long haul their code
wasn't my favorite.

--
"We need to make a sacrifice to the gods, find me a young virgin... oh, and bring something to kill"

Tim Douglass

http://www.DouglassClan.com