[sf-perl] use {strict,warnings}

David Fetter david at fetter.org
Sun Mar 2 16:29:44 PST 2008


On Sun, Mar 02, 2008 at 03:46:33PM -0800, Quinn Weaver wrote:
> On Sun, Mar 02, 2008 at 03:27:35PM -0800, David Fetter wrote:
> 
> > Tests, if you'll pardon the Rumsfeld-ism, are for known unknowns,
> > and they frequently lead to a false sense of security.  It's the
> > unknown unknowns that come up and bite you on the butt.
> 
> True!  OTOH, for mere mortals like me, just making clear one's
> assumptions about what the known behavior is supposed to be (and
> then having a way to verify that they this behavior isn't
> regressing) is a major boon.

For people like me who are even more mortal, it's important, too.  In
an attempt to learn from past mistakes, I created this rule about Perl
code, which is that strict and warnings are mandatory all the way
through the code.  I hope that this rule prevents me from doing things
cleverly.[1]  It's worked pretty well so far...

> Of course, when you stumble across an unknown unknown, you fix the bug
> and write new a test case for it.

This isn't always a good idea.

> Then you continue marching backwards into the future...

It seems to me that people in our business need to cultivate
mindfulness, if you'll allow me a little casual Zen, along with good
habits.  That combination makes for a very tricky path to walk.

Cheers,
David.

[1]  Debugging is twice as hard as writing the code in the first
place.  Therefore, if you write the code as cleverly as possible,
you are, by definition, not smart enough to debug it.
                                                       Kernighan
-- 
David Fetter <david at fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter at gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


More information about the SanFrancisco-pm mailing list