Hacker News new | ask | show | jobs
by cognivore 3742 days ago
I'm going to be a contrarian here and say that if unit tests, in most cases, made economic sense they'd be a given in almost all software development.

But they're not. Do we assume business owners are dumb? Do we assume managers are dumb? That's a popular position for technical people. "Oh, you just don't understand how valuable those unit tests are!"

But the cost of maintaining unit test vs. the cost of fixing bugs later might favor just fixing the bugs later. Maybe it doesn't sometimes - but one is an upfront cost you know about, and one is a nebulous cost that you might or might not have to pay later.

Given that, I know what most people paying the bills are going to choose.

3 comments

It's a question of incentive alignment. Managers are not dumb, their incentives are aligned to short-term success rather than long term. Consider the difference in scenarios between producing ok code very quickly and good code more slowly. The manager will immediately feel the negative consequences of taking the second decision, if their incentives are badly designed. Meanwhile they may never feel the negative consequences of the first decision. When bad code breaks down, how likely is the manager of three years prior the one to take the blame or heat for it, let alone face real consequences? Often they won't.
Business owners are not dumb, they're ignorant ... like the rest of us.

Software engineering is an immature field ; we still have doubts about what practises are beneficial. It comes as no surprise that our managers might not always know what will benefit their software in the long run. The whole notion of technical debt is just starting to make its way into their heads (and into ours).

How many times was your manager astonished by the time estimate you just gave her while she was "only asking you to add a checkbox"?

They make sense dependig on where your business objectives are on quality-speed-cost triangle.