[thelist] Quality Code: Definitions

Paola Kathuria paola at limitless.co.uk
Tue Sep 4 13:14:15 CDT 2001

Frank wrote:
> I was thinking about just what quality code is. Many people say they
> want it, others say they create it, but just what is it?

Do you mean code as in what's written in a programming language
(rather than HTML)?  If so, your list looks like a good start
(although many of the traits can be applied to HTML).

> [3] Reusability: Specific enough to accomplish one task very well,
> general enough to be 'hooked into'.

Although you've described a good trait, I think you're actually
describing modularity (having generalised code that can be used
by called different ways).

Isn't resuability being able to reuse a procedure in another program
(e.g., get input, draw button).  This assumes a greater degree of

> [6] Flexible: Uses appropriate error prevention and trapping
> techniques to deal with unexpected events.

I'd rename this "Robust" and add a new item Flexibility: be able
to add new functions with the minimum of effort (that is: design
for change).


Correctness: whether the code does what it's supposed to do.

Generalisability: code is data driven rather than contains literals
(e.g., when testing against a max value in multiple procedures, set
the max value as a variable or input it from an external file).

Maintainablity: functions are programmed in such a way that they
can be easily understood and changed (that is, a function is
well commented/documented, as self-contained as possible).

Portability: written in a way as to be quickly portable to another
operating system or environment.

There's also separation of function from the user-interface.  Writing
code that does a function but which will still work if the user-interface
is changed completely.

Formal specification - whether a Formal specification exists (and has
been tested for consistency) and that the code matches it.

A search on Google finds other such lists:

1. Correctness.
2. Access Control and Authorization.
3. Integrity and Reliability.
4. Continuity of Processing.
5. Service Levels.
6. Ease of Operation and Use.
7. Portability.
8. Performance Efficiency.
9. Flexibility.
10. Expandability.
(from http://www.cssjournal.com/biehl.html)

1. Correctness 
2. Usability 
3. Efficiency 
4. Reliability 
5. Integrity 
6. Accuracy 
7. Robustness
8. Maintainability 
9. Flexibility 
10. Portability 
11. Reusability 
12. Readability 
13. Testability 
14. Understandability
(from http://www.cc.gatech.edu/classes/AY2000/cs2331_spring/Lecture6/tsld003.htm)

Incidentally, my last programming job before becoming a contractor was
at the Centre for Study of Software Metrics at a London university.  They
looked into quantitative methods of measuring code quality, such as lines
of code, number of procedures, % comments to code.  When one of the
supervisors (a famous software metrics dude) measured the thickness of
her latest report by using a ruler and then telling her that it wasn't
good enough, I felt vindicated that this particular kind of metrics was
mucho bollocks...

Finally, you may be interested in the Psychology of Programming
Interest Group.  We have a *very* low-volume discussion list (which
is archived at http://www.mail-archive.com/discuss%40ppig.org/) and
a small annual conference (in Europe): http://www.ppig.org/


More information about the thelist mailing list