Don’t trust yourself or your code

March 24, 2008 Code craft, Programmers No comments

Jared Parsons writes about how
Part of being a good programmer is learning not to trust yourself. It’s filled with basic but all-too-often-forgotten wisdom about defensive programming. Key bits: “Turn assumptions into compiler errors,” “The best way to avoid making bad assumptions is to actively question them at all times,” and “1 test is worth 1000 expert opinions.”

I also chuckled to see a sidebar disclaimer that said “All code posted to this site is covered under the Microsoft Permissive Lice.” I’d heard of parasitic licensing before, but never like this!

80% programmers

November 26, 2007 Programmers 3 comments

Ben Collins-Susmann writes about the 80/20 split of programmers and how the 20% of programmers who are “alpha programmers” have to account for the 80% who are not, and how they use their tools.

Although the post talks about Subversion and distributed VCSes, the lessons hold for those who use Perl, too. How many programmers have we worked with who don’t know about CPAN, or are afraid to use code from CPAN? How about programmers who don’t understand the internals workings of “standard” Perl objects (i.e. blessed hashes), who don’t realize that a {} is an anonymous hash constructor, not a “class” or “object” constructor? Or who are afraid to use the map and grep constructs?

On the flip side, you don’t want to dumb down your code to the lowest common denominator. Although both Mark Dominus and chromatic have written about it recently, I like Randal Schwartz’s phrasing best: “Sooner or later you’re going to have to write in Perl.” I’m dealing with PHP code at work where the original programmer did not use keyed lookups (PHP arrays are effectively ordered versions of Perl hashes) to check to see if a given string was in a list of special strings. I’m assuming that he was unaware of the ability to look up array elements by key, but I think it would be even worse if he specifically didn’t use the feature out of fear, or worrying about future programmers not knowing what the code did.

Assuming that you’re a 20% programmer (and that you’re reading a programming blog suggests that you are), how do you deal with 80% programmers? Any tricks for the rest of us?

Addendum: Not five minutes after I posted this, I found this article “What if powerful languages and idioms only work for small teams?”, with most of the value in the comments from readers.