Quality Is Not an Option

I have recently participated in a meeting of @MsCodersMadrid, a group of developers that work with Microsoft technologies. The proposed topic was “good coding practices”, and it was an open debate. People shared the tools they use for code style analysis in C#, such as StyleCop or ReSharper. We spoke about comments vs. no comments (NO!), regions vs. they are evil (EVIL!), etc., reaching similar conclusions.

…Then I mentioned unit testing, and things got a little bit hotter. We all agreed that unit tests are important, a good thing, and that any decent software project must have tests.

However, many people questioned the necessity of tests in some cases, and argued that they are optional, a luxury, or out of reach for some scenarios. This is no way specific to any member of this group of developers, and it is not the first time I hear these same arguments, so I will try to enumerate some these with my answers, no fingers pointed.

“The customer does not want quality”:

If a customer admits they want crap, then you don’t want that customer. Let’s say that you run a high class restaurant; You cannot have a cheap “Microwave pizza” at the end of your menu as a low quality option. The moment you offer low quality, you are not high class any more! and believe me, you wanna stay high class or you will be soon replaced by someone even cheaper than you.

“Tests are important, but I have to pay the mortgage”:

When producing low quality software you are ruining yours and your company’s reputation. The world is small, and besides being replaced by a cheaper alternative: How much time do you think it is needed so your fame is so bad that nobody wants to hire you? How will you pay your mortgage then? (Also: notice that guys who say these things in action movies die quite soon)

“Tests are only needed if your team is not mature”:

Sorry, that’s bullśhit. No amount of expertise and skill will keep your code from needing to be changed in the future. Even if you have a team of geniuses, manually testing every feature every time you make a tiny change is awfully expensive. Tests are there to save you money. The most mature and skilled teams I know of, test-drive all their code.

“Tests are only needed if you are developing your own product”:

Very simple: Having agreed that tests are important for quality, you are saying that when the product is for a customer you are purposely delivering low quality so you can then charge extra to fix it later or just leave the mess for someone else. This is not only unprofessional, but also unethical.

“The customer does not want to pay for tests”:

Some argue that the customers will not want to pay for unit tests if you tell them they represent X% of the budget or Y% of the total estimated time. You may have (or want) to specify in your budget that they will get tests, but you are not obliged to go down to that level of detail with percentage or time; Would you also specify how much time do you spend in good naming? Tests are an integral part of software, charging them separately is like your doctor charging you separately for washing his hands.

 

And the list goes on. To end this post, I will use a quote from Michael Feathers that Leo Antoli (@lantoli) reminded to the crowd yesterday. I think it first appeared on Working Effectively with Legacy Code, but also on Robert Martin’s Clean Code:

“To me, legacy code is simply
code without tests.”

-Michael Feathers


istepaniuk

About Iván Stepaniuk

I have been creating software for more than twenty years in a wide variety of stacks, languages and platforms. I advocate Software Craftsmanship and the Agile Manifesto, this has been a great motivation and helps me to continuously reinvent myself as a better developer that makes better quality software.

See my about page


©2014 Iván Stepaniuk. Licensed under CC-BY-SA
Site powered by Jekyll and the Noita theme, built with Foundation
RSS Feed