What’s your avatar?

November 2 2008

there’s a nice paper by Naresh Jain, actually a draft, called Avatars of TDD. basically, Jain recap all the different approaches he found while pairing with a lot of people doing TDD. he categorizes some approaches based on the use of business-facing or programmer-facing tests, acceptance or unit test tools with or without mocking framework, static or dynamic languages and, finally, the paradigm: object-oriented or functional.

and what about you? how do you start working on a story? ok, while you’re thinking, i’m going to tell you something about me.

i first learned TDD while working on my master thesis, and it was also the time i fell in love with mock objects. that’s why i decided to write a mocking tool as my thesis work (the idea was cool, describing TDD while developing a TDD-enabler tool). i also explored FIT/FitNesse for upfront defining acceptance criteria for a given story. that time, i used to start from a FitNesse page and then write unit tests for the most “external” class, mocking collaborators. then, i would have shifted on testing collaborators themselves, and so on. i call this top-down interface-discovery (as first described in the Mock Roles, Not Objects paper).

time has passed, i’ve paired with a lot of developers, and grabbed a lot from their style of TDDing. while still aware of the benefits of mocking frameworks, i now prefer to use hand-written fake (such as InMemoryDao instead of a dynamic mock generated at runtime by a tool), start from the “inner” functionalities, and climb-up till the top, in a bottom-up fashion. my design tools are a quick todo list of main responsibilities, sometimes a rough UML interaction diagram, and a sketch for acceptance criteria drawn on paper. i now focus less on interaction-based tests and more on state-based tests: even for interaction, i end up writing assertions on handWrittenFake.currentState() or spyCollaborator.timesInvoked().

ok, time’s up. hope you enjoyed the story. now it’s your turn: what’s your avatar?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: