Quality of source code

Arjen Markus (17 december 2002) I want to make a statement about the quality of the source code of the Tcl core. I do not mean to flatter the original developers (well, not too much anyway), but I am impressed! Let me explain why:

Last week I discussed the possibility of adding a new operator (exponentiation) to the expr command. I was fooling around a bit with higher-degree polynomials and other such maths stuff and I felt that such an operator would help a lot. Donal Fellows, Jeff Hobbs and Reinhard Max were engaged in this discussion, as well as several others. Reinhard was enthusiastic about the idea, clarified his thoughts about the difference between the existing pow() function and the possible implementation (return floats or integers), Jeff suggested that I try to make a reference implementation first and Donal indicated where to put the necessary changes.

Adding an operator with its proper semantics, precedence and effects is not a trivial matter. I took several print-outs with me, studied them, and decided that it was quite doable.

Then last night, I sat down, added a subroutine to the expression parser to take care of the string ** (my new operator), updated a few tables, added the proper case to the byte code engine (three cases in fact) and of course the subroutines that were necessary for the evaluation if the operands are integer.

Compiling, linking and testing this new implementation revealed various initial quirks and problems. All in all, I had to change about four source files. Source files I had never studied before!

I succeeded in making a reference implementation - in about two hours. Another half hour was required for writing up the TIP, and then I was finished, feeling proud to have achieved this. And feeling proud to be able to work with such software.


escargo 20 Mar 2003 - These are interesting points, but they don't answer the question, What is quality? It looks like the Tcl implementation is maintainable, (or perhaps modifiable), which is certainly one dimension of quality, but what are the other important dimensions. When I was at Honeywell, quality was sometimes defined as, conformance to written requirements. If you do not have verifiable requirements against which software can be measured, then you don't have measurable quality.

AM You have a very valid comment there - I was referring to a subjective type of quality, namely: how easy it is for a (not-always-)humble programmer who does not know the source code to understand it and make non-trivial changes. In terms of the more formal dimensions you refer to, this is a weighing of almost all of them.

DKF - Hmm. Conformance to written requirements is only an indicator of quality if those requirements themselves are of sufficient quality. On the other hand, the general coding-style requirements of the Tcl Engineering Manual (or whatever the silly thing is actually called) do promote code that is of high-quality in a critical area: the resulting code has a high tendency to be understandable by others. If code is understandable, it is also maintainable and easier to evolve to meet other requirements (like correct functioning) if they are not met already.

If you see what I mean.

CMcC - escargo asks What is quality? ... I can't resist suggesting Zen and the Art of Motorcycle Maintenance (http://www.aoe.vt.edu/~ciochett/lit/zen.html ) Not going to get into it, but I don't see the equation between measurable quality and high quality.

jcw - ZATAOMM, wow that brings back good memories.

escargo - The real discussion of the meaning of quality and how it is measured is a complex one, one that is still ongoing. The American Society for Quality [L1 ] and its software division[L2 ] would be some of the organizations involved. Also the Software Engineering Institute [http://www.sei.cmu.edu/ ] would be a good place to look.

In an ad hoc sense, even if we don't have good measures for it, it does sound like the Tcl implementation does have good quality.


Tips for writing quality software