Month: December 2010

Develop sensible coding habits on the path to true Laziness

December 16, 2010 Code craft 7 comments

Whenever I walk in my front door, I walk straight to the kitchen, open the
first drawer, put in my keys and wallet and cell phone, and close
the drawer. Always, without fail, no matter how bad I might have
to take a leak. It is no less convenient for me to do this than
to drop my stuff any old place. It is a habit that I have maintained
for close to 30 years now. And I never ever ever have to wonder
where I put my keys, or my phone, or my wallet. Ever. Having to
do so would be extremely inconvenient. In fact, it would be EXTRA
brain cycles on my part to put them where they do not belong.
When the phone rings, I know where it is. I don’t run around
wondering “Where’s my phone?” trying to triangulate position. It’s
always there in the kitchen drawer. Always.
I also always put on my seat belt in the car. I never wonder if
it’s “necessary”. I just do. Thinking about if it is “necessary”
is also inconvenient. It takes brain cycles that I don’t need to
spend. I also know that the one time I need my seat belt and I
don’t have it on, I’m screwed.
Trying to decide to save three seconds by not buckling my seat belt
is false laziness. And so is worrying about when you can leave out
`warnings` and `strict` from your Perl programs.
Yesterday in IRC, someone was lamenting that Perl 6 effectively has
`warnings` and `strict` on by default. All variables must declared
before use. This person was one of those programmers who tried for
the premature optimization of saving some typing. He forgot that
typing is the least of our concerns when programming. He forgot
that programmer thinking time costs many orders of magnitude more
than programmer typing time, and that the time spent debugging can
dwarf the amount of time spent creating code.
He also forgot that he’s a human.
Checks like `warnings` and `strict` are there because we are fallible
humans. We type `$totl` instead of `$total`, and we want Perl to
tell us that. We try to dereference scalars and since we’re no
longer using Perl 4, we want Perl to tell us about that, too. We
want Perl, which is a program and doesn’t get sloppy and forget
things, to catch us when we are humans and get sloppy and forget
Buy and read *The Pragmatic Programmer* and *Code Complete* and
develop a solid set of programming habits from them. Sensible
habits that are followed even when you might be able to get away
without them are the true Laziness.

Perlbuzz news roundup for 2010-12-08

December 8, 2010 Community, CPAN, Perl 5, Perl 6 No comments

These links are collected from the
Perlbuzz Twitter feed.
If you have suggestions for news bits, please mail me at