October 4, 2022Homes have junk drawers. Code has junk drawers. But they aren't the same.
Every house has a junk drawer.
It’s where we put random small or unique items that don’t really belong anywhere else.
Many code bases have junk drawers, too. They’re usually classes or packages with names like “helpers”, “utils” or “common”.
Does the fact that your house has a junk drawer justify a code junk drawers? I don’t think so.
If physical drawers were free, and took up no space, we probably wouldn’t have junk drawers in our homes, either.
If it was economical and space-efficient to create a drawer just for rubber bands, why not? And why not a drawer just for the stapler? And a separate drawer just for the battery door that fell off of a random toy your kid got for Christmas last year.
Obviously, that’s not practical in the physical world.
But in code, those “drawers” are free. So there’s never a good reason to start throwing your code “junk” into a junk package. Give each package/class its own meaningful name. Even if it only contains a 2-line helper function. Classes are free. Use them!
The mechanics of test-driven development
Red-Green-Refactor may describe the mechanics of TDD, but not its essence.
What's the relationship between TDD and Evolutionary Design?
TDD doesn't give you ED for free, it only makes it easier.
TDD is slower the same way a drop cloth makes you slower
Painting without a drop cloth may be faster, but the hours of clean up outweigh savings.