Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Hidden Functionality of Perlmonks

by Sherlock (Deacon)
on Apr 27, 2001 at 04:51 UTC ( [id://75976]=perlmeditation: print w/replies, xml ) Need Help??

I've been working on a script using HTML::Template and it just so turned out that I needed to do a triple <TMPL_LOOP> within my template file and it was giving me fits. I didn't especially want to post it on Perlmonks because the script was exceptionally long and I didn't think anyone in my office would be able to help me with it as I thought it would most likely be over their heads (not to mention that none of them have ever dealt with HTML::Template before), but I just couldn't seem to find the bug.

Finally, I decided that I had no choice - I was going to post some of the code (not enough to make it run, but hopefully enough so that people could get the idea) on Perlmonks and see if someone could understand enough of it to help me out.

As I was writing my post, I was trying very hard to explain exactly what the script was doing and how it was failing when I realized there was a pattern to the failure that I hadn't considered before. I quickly went back to the script, made a quick change, and had a fully functional appointment book. Simply by trying to explain the script on Perlmonks, I was able to solve my own problem.

I've used this technique before - explaining my code to someone (even if they have no idea what I'm talking about) and I believe Mission mentioned it in a recent post: The 'Code Block' when he said that he often discusses code with his wife and often finds his own mistakes while trying to explain what he's doing.

I just wonder if this works for a lot of other monks out there and what else you all might do when you really get stuck. Where do some of you turn when you don't think anyone can help?

- Sherlock

Replies are listed 'Best First'.
Re: Hidden Functionality of Perlmonks
by arhuman (Vicar) on Apr 27, 2001 at 11:18 UTC
    When I get struck, I SLEEP.
    Often I got an answer when I wake up.

    Do you think I should worry to be smarter when I sleep than when I'm awake ? ;-)

    Seriously, sleeping allow me to think about a subject without some 'mental locks' that are setup when awake.
    Furthermore it's much less exhaustive than thinking awake :-)

    "Only Bad Coders Badly Code In Perl" (OBC2IP)
      Just like the syndrome where you've gotta go to the bathroom as soon as you've plopped yourself on the couch to watch your favourite TV show, I find that when I try to execute the "sleep on it" strategy, most of the time, I think of an answer just before I'm asleep :o)

      . . . and then, I just HAVE to get up and make it work. Good, since the nearest pooter is across the room.

      --
      Me spell chucker work grate. Knead grandma chicken.

Re: Hidden Functionality of Perlmonks
by zigster (Hermit) on Apr 27, 2001 at 13:42 UTC
    Yea, I refer this this as the cardboard programmer. Ohh so often explaining the problem is so helpful.

    Does anyone know the origins of the term cardboard programmer? I am sure I did not create it.
    --

    Zigster

Re: Hidden Functionality of Perlmonks
by TeKk9 (Scribe) on Apr 27, 2001 at 07:01 UTC
    Quite a few times I've actually called it quits and gone to bed only to wake up several hours later with the answer being (devinely?) delivered in my sleep. I usely jump up and start hacking on it before I forget.
Re: Hidden Functionality of Perlmonks
by Clownburner (Monk) on Apr 27, 2001 at 05:05 UTC
    When I get really stuck, I drop acid and stare at a wall for 8 hours.

    Oh, you meant in Perl? Nevermind. :-P
    Things should be as simple as possible, but not simpler. - Einstein
Re: Hidden Functionality of Perlmonks
by jepri (Parson) on Apr 27, 2001 at 05:34 UTC
    That's worked twice for me in the last week and the third time I sorted it myself after reading a few responses to my question.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: Hidden Functionality of Perlmonks
by mrmick (Curate) on Apr 27, 2001 at 17:06 UTC
    If I recall correctly, "The Pragmatic Programmer" calls this "rubber ducking". As a reference to a programmer describing his problem to a rubber duck sitting on the programmer's monitor.

    Mick
Re: Hidden Functionality of Perlmonks
by petesmiley (Friar) on Apr 27, 2001 at 06:46 UTC
    Personally I'm not too big on psychadelics ;) Usually, I go watch reruns of old movies and eat a large desert, or go walk around my office building for an hour. When I get back to it, I reread my code and many times the problem screams at me. Sometimes the brain needs a reboot to clear the memory :) Sometimes this doesn't work, and explaining it to someone works very well.
(jcwren) Re: Hidden Functionality of Perlmonks
by jcwren (Prior) on Apr 28, 2001 at 07:10 UTC

    This reminds me of a product a friend and I spec'ed out about 12 or 13 years ago, called 'Full Length Mirror'. Basically, it was an audio generator that said things like "Yes, I understand." or "Why is that?" (slightly Eliza-ish, but nowhere as deep). The idea being, as your explained your problem to it, it would acknowledge your speaking, and you'd get the "D'oh!" effect in short order.

    --Chris

    e-mail jcwren
Re: Hidden Functionality of Perlmonks
by ZZamboni (Curate) on Apr 28, 2001 at 20:55 UTC
    I call this "debugging by confession", and it is almost always very effective. Trying to explain things to someone else forces you to structure your thoughts and think about the functionality of each piece of your code, which usually leads to finding the bugs :-)

    Whenever I'm stuck with something, I usually walk into one of my neighbor offices or cubicles and start talking about my problem. Usually a solution comes up shortly afterwards.

    --ZZamboni

Re: Hidden Functionality of Perlmonks
by coreolyn (Parson) on Apr 27, 2001 at 18:18 UTC

    Many times I found that writing the problem down in the form of a question either relieves 'the block' or at the least helps to point me in a good direction for research.

    coreolyn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://75976]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-24 03:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found