« October 2006 | Main | February 2007 »

November 07, 2006

Time to go home? Leave a broken test

I often have to take a few minutes at the beginning of each day to remember where I left off yesterday. I've tried things like leaving a note to myself to remind me of the details of my work in progress.

The most effective thing I've found, though, is leaving a broken test.

It's simple and effective if you're test-driving code. For example, let's say I'm writing a class that encapsulates whether a password meets a password policy. I'm hungry, tired and want to go home in time to go for a run:

[Test]
public void ValidPasswordMustHaveANumber()
{
    Password password = new Password( "PasswordWithNoNumber" );

Assert.IsFalse( validator.IsValid( password ), "passwords without a number are invalid" );
}

When I come in the next morning I'll run the tests and see:
Assertion failed: passwords without a number are invalid.

Then I'll remember where I left the previous day.

Posted at 07:50 AM | Permanent Link | Comments (5)

November 01, 2006

Please Find Posted This Blog Entry

A poorly constructed and tired phrase in email writing is:

Please find attached the document that you requested…”

This phrase is verbose, passive, and imprecise. Strunk and White cringe every time it is used.

It is imprecise: Who attached the document? You? Me? The Document Fairy? The phrase doesn't convey the actor.

It is verbose: The alternative, “I’ve attached,” is shorter.

It is passive: It uses third person passive voice.

Don’t use this phrase. Replace it with the straightforward and concise “I’ve attached the document…” It should be included in chapter 5 of the next edition of Elements of Style.

Posted at 07:48 AM | Permanent Link | Comments (1)