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
"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.
Merciless Refactoring (Score:2)
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:
Now, George wasn't cavilie
Re:Merciless Refactoring (Score:1)
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
rjbs
Re:Merciless Refactoring (Score:2)