Aspects of software quality

A little while ago we were doing a lot of hiring on my project team. I got a little tired of asking all the same interview questions and mixed it up a bit. One of the questions I came up with was:

Code should be correct, efficient, maintainable, and testable. Rank those four qualities in order of importance.

I consider one of them a gimme: efficiency, or optimization, or performance, whatever,  should generally be the last thing that you look at. There are exceptions to this, but you generally don’t see them in corporate environments. Ranking the other three can be an interesting exercise.

Correctness, which means that code does what you expect it to do, may be considered the most important thing. Here’s my problem with that answer: if code isn’t testable, how can you prove that it works? And if it isn’t maintainable, how can you manage changes to the code as the underlying business rules change?

That leaves maintainability and testability. Of the two, I think maintainability is more important. The concepts are closely related – if your code is easily testable, then it’s more likely that you’ve followed some conventions (short code blocks, single responsibility principle) that make it more amenable to being tested.

This leads to this ranking:

  1. Maintainability
  2. Testability
  3. Correctness
  4. Performance

I’m not claiming this is the correct answer, but I think it’s the correct one for me.

One more note: after doing a bunch of code reviews this week, I realized I’ve left something quite important off the list: design. Things like whether something should be an abstract class or an interface, or what a method signature looks like, that sort of thing. It’s an aspect that overlaps with others, notably maintainability and correctness. It’s a difficult one to rank as well – what good is maintainable, correct code if no one can easily use it because of design flaws? What good is well-designed code if it doesn’t work? I don’t think it’s in the same dimension as these other aspects, but then it’s all arbitrary anyway.