Author:
Steve McKeever
Affiliation:
Department of Informatics and Media, Uppsala University, Sweden
Keyword(s):
Units of Measurement, Quantity Pattern, Libraries, Component based Checking, Testing.
Abstract:
In scientific and engineering applications, physical quantities expressed as units of measurement (UoM) are used regularly. If the algebraic properties of a system’s UoM information are incorrectly handled at run-time then catastrophic problems can arise. Much work has gone into creating libraries, languages and tools to ensure developers can leverage UoM information in their designs and codes. While there are technical solutions that allow units of measurement to be specified at both the model and code level, a broader assessment of their strengths and weaknesses has not been undertaken. Inspired by a survey of practitioners, we review four competing methods that support unit checking of code bases. The most straightforward solution is for the programming language to Natively support UoM as this allows for efficient unit conversion and static checking. Alas, none of the mainstream languages provide such support. Libraries might seem compelling, and all popular programming languages
have a myriad of options, but they’re cumbersome in practice and have specific performance costs. Libraries are best suited to applications in which UoM checking is desirable at run-time. Lightweight methods, such as Component based checking or Black Box testing, provide many benefits of UoM libraries with minimal overheads but sacrifice coverage and thus robustness. By separating and analysing the various options, we hope to enable scientific developers to select the most appropriate approach to transferring UoM information from their software models to their programs.
(More)