3 ms·
I’ve had the privilege of refactoring age-old code, and it takes more than two hands to count the number of times I’ve named a class “TestableMegaFoo”, whereby
by ramses0 3y ago
I’ve had the privilege of refactoring age-old code, and it takes more than two hands to count the number of times I’ve named a class “TestableMegaFoo”, whereby little testable bits of “MegaFoo” have been judiciously migrated to.
There’s another comment in here talking about feng-shui and dragons, I’ll recount the story of “peace pipes” and “killing your enemies”.
It’s tough to find in the modern internet, but I remember reading about Native American traditions of gathering around a piece pipe and applauding your enemies, looking for the good in them, effectively.
The story goes that if you do this enough, your enemy “disappears” and you see them as friends.
So it can be with code. Class MegaFoo simply becomes calls to “TestableMegaFoo”, with a few usual side-effect inducing “less testable components”. Your enemy disappears in a puff of smoke.