Prev Up Next
Go backward to Automatic Program Specialization by Partial Evaluation
Robert Glück

Go up to Foundations and Methodology Comparisons
Go forward to Polytypic Programming
Johan Jeuring


Evaluating Generic Programming in Practice
Mehdi Jazayeri

We all think generic programming is wonderful and will lead to improvements in software engineering. But other than an intuitive feeling about it, how do we really know it? How do we convince practicing software engineers that this is a technology they should learn and use? While many researchers are busy developing new techniques and extensions to old ones, we should also pay some attention to concrete measurements of the benefits of the technology. With the appearance of STL, we have an instance of a generic programming library that may actually be useful in practice and therefore can be used in experiments to measure the benefits of the technology. We have conducted one such experiment. The results are not conclusive or even convincing. But it is a start and we see future steps to take. The experiment involved transforming a 5000-line network-management program written in C into a C++ program. The major part of the transformation was to replace hand-crafted C-code to the use of STL data structures and algorithms. We expected to see a reduction in code size because of the replacement of repeated code sequences by calls to library routines. In fact, the code size did not change appreciably. The pure code (.c files) decreased in size while the header files (.h files) increased in size. Intuitively, we can argue that the new code is better because it factors common code into header files. The code size measure, however, does not prove the superiority of the new code. It is possible to conduct experiments to see how maintainable the code is but such experiments are expensive and are usually not convincing. Instead, we prefer to look for code metrics that are more appropriate for evaluating generic code.


 

Prev Up Next