Technical Report 2020-004

Impact of Code Refactoring using Object-Oriented Methodology on a Scientific Computing Application

Malin Källén, Sverker Holmgren, and Ebba Thora Hvannberg

October 2020

The effect of refactoring on the quality of software has been extensively evaluated in scientific studies. We see a need to also consider its effect on performance. To this end, we have refactored the central parts of a code base developed in academia for a class of computationally demanding scientific computing problems. We made design choices based on the SOLID principles and we used object-oriented techniques in the implementation. We discuss the effect on maintainability qualitatively and also analyze it quantitatively. Not surprisingly, we find that maintainability increased as an effect of the refactoring. We also find that dynamic binding in the most frequently executed parts of the code makes the execution times increase significantly. By exploiting static polymorphism, we reduce the increase in execution times, and in some cases even get better performance than for the original code. We argue that the code version implementing static polymorphism is less maintainable than the one using dynamic polymorphism, although both versions are considerably more maintainable than the original code. Accordingly, we conclude that static polymorphism could be used to increase maintainability for performance critical code bases. Last, we argue that static polymorphism could even improve performance in some procedural code bases.

Available as PDF (511 kB, no cover)

Download BibTeX entry.