Stories
Slash Boxes
Comments
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 ]

jdavidb (1361)

jdavidb
  (email not shown publicly)
http://voiceofjohn.blogspot.com/

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Tuesday November 29, 2005
08:14 AM

Something I should know

[ #27787 ]

If you are going to execute a particular piece of code twice, then you are going to execute it three times some day, and you should therefore put it in a subroutine. (Or module.)

It's always true, or at least true so often that you should always assume it is true so you don't hate yourself later.

The fun part here is I'm thinking about this after doing the right thing for a change, rather than the wrong thing: I cut and pasted some code and then when the idea to refactor suggested itself I considered not doing it. But I did, anyway, and immediately after finishing remembered, "Oh, yeah: I'm basically enhancing an existing program that handles case 1 to handle case 3 as well. Some day, somebody is going to ask me to handle case 2."

And all this by only four minutes after the sun comes up today.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.