Maybe you could translate that for me. I’ve never heard two people use the word “refactor” with anything like the same meaning.

I write code for correct and stable execution. If unit testing leads to compromise of that goal then that argues against unit testing. As I have said elsewhere, the more I learn about unit testing the less I like it and the more I advocate traditional blackbox testing.

As plainly as I can say it, testing is secondary, it is not the goal of our work.

Unit testing requires more and more compromises, This is another of those imperatives, like people who argue for early returns over an unexamined assertion that “indentation is bad.”

So now I am hearing that I should “refactor” (doesn’t that just mean “edit?” Why not just say “edit” instead of bludgeoning me with jargon?) my code to make it testable in a fashion that I don’t see a lot of value in. Should I make private functions public to make them testable? Should I adulterate the design with test-only code paths? How far does this unit testing imperative extend?

I addressed this more specifically a few days ago.

Written by

American Software Developer living in Vietnam. Classical musician (guitar, woodwinds), weightlifter, multilingual, misanthrope • XY

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store