Quantities and units in software models

University essay from KTH/Skolan för elektroteknik och datavetenskap (EECS)

Author: Marcus Östling; [2020]

Keywords: ;

Abstract: Quantities and units, while they are commonly used in science and engineer-ing, they are not at all that common in software. The purpose of this thesis is to study how quantities and units can be incorporated into software, and what the impact of such an incorporation would be on the software’s source code as well as its performance. This was achieved by first designing a solution and implementing a proof-of-concept of it. The proof-of-concept was used to evaluate the impact on the software and compare it to the existing library UnitsNet as well as a solution using the primitive type double. The design resulted in a statically typed solution and the impact on the source code was measured on two large codebases, 265k and 1138k lines of code. The software metrics barely showed any difference between the solutions, but the opinion of asked developers showed that a statically typed solution was preferred over a solution that used the primitive type double. The performance tests showed that when the types were used in composite functions, it had the same rate of growth as the solution using doubles had. But, the statically typed solutions did increase the execution time by a constant factor. The constant factor could result in ≈50 times slower execution time.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)