Monday, August 17, 2009

By Any Other Name

Note: Cross posted from The Typemock Insider Blog.

Permalink

I’ve read Mark Needham’s post and Julio Maia’s post on impersonators. They are a good read, by the way. And they reminded me of habit we developers have that helps us shoot ourselves in the foot.

Names. Where would be without them? How can we get along without verbally differentiating between this thing, and that other thing, which is similar, but not that similar?

I always come back to patterns as an example. Because they have names, it increases the communication level, since we don’t want to describe and re-describe everything over and over again. When I say Visitor, I assume that people know what I’m talking about. Smart ones, of course, I don’t hang around with other kinds.

But we can go too far with it. Mocks, stubs, fakes, test doubles, impersonator (which is a self-initializing test double, if you didn’t know), and probably other sub-types. Sure there’s a difference, Martin Fowler said so.

With all due respect to Martin (I worship the Refactoring book), this is doing more harm than good. Categorizing is ok, but most people don’t have all the nuances in their heads. When they begin to read about unit testing, they find out there’s a big pile of things they need to learn. When I see a great pile of reading  material in front of me, I’d probably won’t read it. I might discard the subject altogether since it’s obviously complex, and I don’t want to deal with it.

Yes, it’s a jargon. And for the few that can spend hours discussing the specifics of when to use what, it’s very impressing. But for making the breakthrough and getting people on board for your cause, simplicity is key.

Let’s use a simple language. When we need the little details, we’ll call, we promise.

So dear readers: Which ones do you use?

Saturday, August 15, 2009

Plug Your Own Leak

Note: Cross posted from The Typemock Insider Blog.

Permalink

This week I met a very clever developer. I know that when I say “clever'”, it usually leads to a horror story. Not this time. This guy is smart, built a very smart application. He put a very strong emphasis on good OO principals. Worked against interfaces. And he wrote his own hand-rolled mocks.

I wrote before on the cost of using hand-rolled mocks and why you need an isolation framework. It’s a terrible waste of time, code, and a maintenance debt you carry for the application’s lifetime. Without proper attention it can get out of control, when you start putting if-then implementation in the mocks, to fit the logic in the code. That’s when you have a horror story.

And then I read Oren’s post, reminding me that we shouldn’t steal from our customers. It’s also true when our customers are our employers or ourselves. There’s no excuse for writing boiler plate code, including hand rolled mocks. There are already tools to help you.

There’s a leak in the process. Plug it.

Use the right tool for the job.

Related Posts Plugin for WordPress, Blogger...
Twitter Delicious Facebook Digg Stumbleupon More