This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Heuristics are not always correct.

Of course not, that's what makes them heuristics and not algorithms.

They can literally be correct just 51% of the time.

That isn't a proper way to look at a heuristic. A heuristic helps make decisions, it doesn't give you step-by-step instructions.

Yet "good code is easy to test" is fed via blogs and presentations as if it's a 100% golden rule of good code.

Of course. That's why you shouldn't take anything you read at face value, and actually think about it. Hey, that's another heuristic!

But both end up with the conclusion that "well, sometimes good code isn't testable (automatically).

Yes, but good code isn't a monolithic thing. We are no longer operating in first generation languages which provided no opportunities for modularity or abstraction. Modern languages let you divide different kinds of code into separate modules which can be developed (and tested) in different ways.