Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Re: Coding while drunk

by sauoq (Abbot)
on Sep 12, 2002 at 19:22 UTC ( #197317=note: print w/replies, xml ) Need Help??

in reply to Re: Coding while drunk
in thread Coding while drunk

What you did was stumble across a combination of stuff that "works", but which you don't understand. That's not solving, that's hiding a problem somewhere else.

He may have understood it fine when he wrote it. Just because he can't seem to recall that understanding doesn't mean he didn't solve it. We all run into that sooner or later, drunk or not.

I do agree that he should regain his understanding, test it, fix it if necessary, and probably comment the code. That's the same advice I'd give anyone that had written some code and forgotten how it worked.

"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Re: Coding while drunk
by gregor-e (Beadle) on Sep 12, 2002 at 21:18 UTC
    Programming languages are meant to communicate a solution to another human through a conversation that a computer is barely smart enough to understand. If you can't even understand your own code, then it doesn't communicate a solution. It may as well have been a bunch of raw hex digits, which would at least be convenient for the computer. I agree with the earlier poster - toss and rewrite. But this time imagine that a sociopathic homicidal maniac who knows where you live will be the next one to have to understand your code.

      I did a a few comp-sci classes at Uni as aprt of a degree that I never finished, any-way one of the lecturer's said (quoting someone else) something that has greatly influenced the way I write code-

      "a program is a letter from one programmer to another that just happens to be understandable by the computer as well"

      I always try and keep that in mind when I program. I don't necessarily agree that Gordy needs to throw away what was written but it certainly needs to be understood, "I get the result I expected" (for all the test conditions I thought of) is far short of good enough.

      Until you've lost your reputation, you never realize what a burden it was or what freedom really is. -Margaret Mitchell

      Programming languages are meant to communicate a solution to another human through a conversation that a computer is barely smart enough to understand.

      I repectfully disagree. Programming languages are abstractions that allow humans to write complex instructions for a computer while remaining isolated from the lower level requirements of the implementation. By the way, no computer is even "barely smart enough to understand" those instructions. Computers just follow them.

      I wasn't really disagreeing with dws in principle. In fact, I agreed that the original poster should regain his understanding of the code. I also suggested that he comment it (for the future) and test it.

      I only disagreed that the code should be discarded out-of-hand simply because the poster was drunk when he wrote it. Of course, if he is unable to regain his understanding, then it should probably be rewritten. That, however, has its own hazards and might come with its own bugs. That brings us back to testing...

      "My two cents aren't worth a dime.";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://197317]
and !@monks...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-10-18 15:19 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (249 votes). Check out past polls.