|Do you know where your variables are?|
I stopped by a colleague's office recently and asked how things were going. She explained that she was tasked to write a screen-scraper and that she was having trouble with a regex. I offered to help and asked to see the code, to which she replied
"OK, but don't go all PerlMonks on me."I must admit I was a bit surprised and consequently I didn't hear much of what followed - it was something about white space and angle brackets.
...don't go all PerlMonks on me... The words echoed through my head. What did that mean? Was it a compliment? I do try to be helpful and she knows that much of my knowledge can be attributed to PerlMonks. Perhaps it was more of a playful jab. I am guilty of inflicting informal and unsolicited code reviews on her in similar circumstances in the past, and sometimes I lose sight of the immediate goal (just make it work) and instead suggest alternative designs that would provide additional flexibility and be more robust (see XY Problem).
As I regained focus I realized that she was looking at me expectantly. I studied the line in question, and then I looked at the surrounding code.
"Are you parsing an HTML table?"I had an opening. In the next few minutes I learned that she inherited the code from on-high and was told to make it work (which may explain why she wasn't as sensitive to the suggestion as I feared). After I explained some of the advantages of using a parser, I told her that if she could give me 20 minutes I'd whip up an example for her. She agreed.
I went back to my office and ripped the guts out of the script that she was working on. I replaced nearly 100 lines of code with the following:
I walked back to her office and asked her to open up my version of the script. She gasped. "It's so short!" I smiled. "Yup - and it works, too."
As I left her office I thought of those words: don't go all PerlMonks on me. I'm still not sure what that means, but I think I did... and I'm proud of it.
Thanks, PerlMonks, for helping me to help make someone else's job a little easier.