Painting while blindfolded

In a discussion yesterday about how to know if our code was thoroughly tested, one of my tech leads mentioned "Unit testing without a code coverage tool is like painting a wall while blindfolded". I think it's a very apt metaphor, and something that developers should take to heart.

In most modern programming languages, there are tools to both automate unit level tests as well as determine how much of your code was actually executed as part of a test run. To run unit tests without validating what has and hasn't been covered is unprofessional. Imagine if you hired someone to paint your house and the first step is to blindfold themselves...what is your confidence that they will do a good job?

What amazes me is that I've heard a number of developers repeat this phrase "My professor told me that 100% code coverage is practically impossible"...which seems to lead them to the inevitable conclusion that "so therefore I won't write ANY tests". Fine 100% is tremendously difficult (especially if your code is poorly thought out or a "bad design (TM)", but 100% is NOT practically impossible...anyone who says this is either: #1 a hack, or #2 unprofessional. On that note, I will point out that typically CS/CE professors are quite often not professional developers or engineers, they're more often academics and/or scientists.

P.S. Professors, please stop saying this to your CS/CE students...

Comments

Popular posts from this blog

Push versus pull deployment models

the myth of asynchronous JDBC

Installing virtualbox guest additions on Centos 7 minimal image