Do not introduce extra logic for tests.

All logic should serve a business purpose.

There’s a fun phrase, I believe it came from DHH, “test damaged development”. It occurs when a developer finds that in order satisfy his tests, he has to introduce some new logic to the code that doesn’t serve any practical business purpose. When this occurs, it is a bad thing.

Getting TDD right takes a lot of practice and this is one of the traps that some people fall into. Try to avoid it.

When you find yourself adding unnecessary logic, it’s a good time to pause and bring in a fresh set of eyes. Maybe there’s a better way of doing things. Adding code for coding’s sake is not good.

Leave a Reply

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

You are commenting using your 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: