ArticleS. MichaelFeathers.
SallysExploration [add child]

Sally's Exploration


1 2 3 4

Sally's door creaked as she walked in and hung up her jacket. Her apartment was paneled in dark wood.. not that you could really see it. The walls were covered with bookshelves and posters. Tables with tettering stacks of books and papers lined a wall next to her computer. She dropped her tote-bag and shook the chair at her desk before she hurriedly sat down. Hoover, her cat, used to the routine, fell from the chair and dropped onto his side. The taciturn gray feline looked at his agitated roommate with amusement.

"Let's see", said Sally. "How often can we use the null trick? What are its downsides?" Sally had been thinking about these questions all the way home on the T. She brought up classes from toy projects on her computer, and odd bits of open source code she'd downloaded. She looked at how often constructor parameters were really used in constructors. For the most part, they are used, she thought. But there were some cases... cases where classes have large numbers of fields... Sally started to look at methods. How many of them could accept null as a parameter and still do something useful? Practically none. It seemed that most people had the good sense to really use all of the parameters that they pass to their methods. "Despite all evidence to the contrary, most people people aren't completely stupid", she said to herself quietly.

"What is it about constructors?" she thought. Then the answer came to her. Not all methods use all fields. If a constructor of a large class just sets its fields using its parameters, there is a decent chance that some of the methods won't need them.

Still, Ramon had a point. Why pass null if you were going to have to pass the real object in other tests? Sally thought about the Configuration class that the TradeColumnHeader class needed. She had taken a brief look at it before she left work. Sure enough, it loaded a configuration file in its constructor. There really wasn't any need to do that in a test. Maybe they could use a fake, a class that impersonates a Configuration when they are testing. It was interesting that they were able to fix that bug without getting the fake in place right away, though.

Sally decided to talk to Ramon about this some more on Monday. She pushed back her chair and started to get up.. thinking about the weekend.. going out with Lisa and Ashley tonight.. but before she stood she saw a new email message:


Subject: 'Get Acquainted' Meeting
From: Aiden Finn
To: Ramon Rivera, Sally Strand

Hi. I'd like you both to come around to my office (Marco's old office) at 9AM Monday. There
are some things I'd like to discuss with you about our plans moving forward.

Aiden Finn
Development Manager, Hhai Team


Sally sat as if planted while she thought about the message. Hoover ambled up and rubbed against her calf.
"Lucky Hoover", she said, "cats don't have Mondays."

It was a long weekend, a good weekend, but eventually Monday came.

1 2 3 4


!commentForm