Software Measurement and Functional Programming
K.G. van den Berg · 1995
Software metrics have been investigated for the assessment of programs written in a functional programming language.The external attribute of programs considered in this thesis is their comprehensibility to novice programmers.This attribute has been operationalized in a number of experiments.The internal attribute of software which is examined is the structure.Two models for the structure of software have been employed: callgraphs and flowgraphs.The proposed control-flow model captures the operational semantics of function definitions.The objective measurement of the attributes has been supported by tools.The validation of structure metrics has been addressed in certain experiments for programming-in-the-small.The structure of type expressions in functional programs has been analysed in a case study.A simple framework for software metrication proved to be useful.The validation of metrics has been linked with axioms from the representational measurement theory.The control-flow model for functional programs showed its value in the set-up of an experiment regarding the influence of the structure on the comprehensibility.A programming style rule on the use of guards in function definitions has been validated by the findings in this experiment. SummaryIn general, a producer is interested in the quality of his product, whether it is a software package or, for example, a car.There are quality aspects which are important to the user of the product, such as for a car the fuel consumption rate.Other quality aspects are relevant to the technicians who have to build the product or to maintain it: e.g. the ease of assembling certain parts.Furthermore, the producer will be interested in the cost and duration of the production, and the resources needed.Such quality aspects have to be measured to allow a comparison with other products and production processes: a particular fuel consumption rate will be acceptable in certain circumstances.A similar situation is encountered in the case of software.There are user aspects of quality, for example with respect to the interface and performance, and other aspects related to the programmers who have to design and implement the computer programs.The discipline of software engineering offers methods for the design and production of software.The field of software measurement provides approaches to the quantification of quality aspects of software, related to the product, the process and the resources.An obvious software metric is the size of the program, usually expressed in the number of lines of executable code.But there are many other software metrics, and it is necessary to be able to decide when to use which metric and how.With these metrics, one would like to be able to make an objective assessment of the relative merits of software products and software development methods.This thesis addresses some issues on the quality of software with respect to the programmers: the comprehensibility of the program code.A lot of time is spent reading and understanding programs in order to remove faults or to adapt the program to changed requirements.Many factors in the program code affect the comprehensibility of the program, such as the language used, the naming of variables, the structure, the indentation, explanatory documentation, the experience of the programmer, and so on.In order to capture a particular quality aspect of programs, usually a model is built.In such models, certain details in the program are abstracted.The models are used in the definition of software metrics.The models and metrics 1 The references are given at the end of the thesis 2 Miranda is a trademark of Research Software Ltd. Chapter 1The interest in the expenditure of human resources on the development and operation of software systems has manifested itself in attempts to quantify software complexity.Complexity is perceived as the 'root of all evil' and if only it could be reduced this would bring about attendant reductions in all manner of software evils: excessive development and testing effort, unreliability, and unmaintainability.However, no researchers have yet been able to give an adequate definition of the term complexity (Shepperd & Ince, 1993).Some complexity metrics are considered in this thesis: McCabe's complexity metric in Chapter 3, and other flowgraph-based complexity metrics in Chapters 4 and 5. Software complexity is believed to be reduced by using development methods which provide structure to the process and the products.It is an 'axiom' of software engineering that a good internal structure yields a good external software quality (Fenton, 1991).Many software metrics are described in the literature.Not only do these metrics aim to measure a wide range of attributes but also there are often many irreconcilable metrics all claiming to measure the same attribute such as cost, size or complexity.The reason for this state of affairs is commonly attributed to a general lack of validation of software metrics, i.e. ensuring that the metric is a proper numerical characterisation of the claimed attribute.Axiomatic Testing of Structure Metrics 8 13 Nonstructured vs Introduction Conclusion