Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

  (email not shown publicly)
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Tuesday December 14, 2004
03:52 PM

things i like: refactoring, reuse

[ #22312 ]

Refactoring code is the best. By making a promise to myself to refactor (mercilessly), I can get my code written quickly, It isn't beautiful, but it works. I get to write lots of code. Then, when it works, I get to go back /and write it again/! Not only that, but I get to make it better. Then, because it's better, I can use it to do more things, which I code quickly, and then get to re-code.

"I will show less mercy in my refactoring" would be a good New Year's resolution for any programmer.

Also fantastic is having a really, really nice set of tools at one's disposal---and not just that*, but knowing how to use them. It's also nice to see unintended ways to use them, although that's not as easy a skill to acquire. The more I write code, lately, the happier I feel as it takes fewer and fewer words to say what I mean. The clarity of the code feels like it enhances the code's meaning, like a haiku. As in a haiku, the utter simplicity of the image is, itself, complex and profound. (I realize that I am no Basho of coding, but I am feeling less like a Bukowski.)

I rewrote some ugly parsing code, today. It reads my blog entries, pulling out the "name: value" headers and the body, and does some processing on the values. It was darn easy to replace with Email::Simple, which is now going to show up in a lot of my non-email code. Config::Auto keeps teasing me with ideas for improvements that I can't quite put my finger on. I know I can do something simpler with SQL::Abstract to Rubric's most important search method tiny. And maybe it's time to get back to Querylet and GutenbergRoget?

Last week, I was feeling bad about coding. I am feeling good, today. I think I just needed some positive re-enforcement. Halo 2 co-operative might have helped, too. I wish I could play co-op online!

[*] Another resolution: I will try to stick to just one way of writing em-dashes. Probably \w---\w, as in LaTeX.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • "I will show less mercy in my refactoring" would be a good New Year's resolution for any programmer.

    Yes, but how merciless will you be?

    A good friend of mine, let's call him "George", would get deeply involved in some code he was writing, and would occasionally get tired of chasing the odd bug. His response was the famous three step process:

    $ rm *.[ch]

    wait 15 minutes

    Tell the boss, "Oops. I accidentally deleted all my source code. Guess I'll have to rewrite it now."

    Now, George wasn't cavilie

    • I'm not quite that merciless, and I'm not quite sure I'd want to be! Then again, I've gotten merciless enough in that direction to get some funny looks, following my reading of chromatic's writing on "Integrate Often," something like this here [].

      As is normal, I try to commit after every (write-test; code-code; pass-test) cycle, and I try to keep those cycles smallish. I refuse to leave my CVS checked out overnight, and delete it if it isn't committed. Some people think this is bizarre enough, but I've fou
      • If nothing else, I suspect you'd generally want to keep the tests so that you can verify that the "refactoring" didn't break anything. So, starting the project over, completely from scratch, is a bit extreme in a non-XP sort of way.