Comparing Software Complexity of Monadic Error Handling and Using Exceptions

Gergely Nagy · 2019

Exception handling has been the definitive way to handle errors of any kind and exceptional circumstances in modern software. Using exceptions ease comprehension of single-threaded software by reducing complexity, but concurrency and asynchronous programming models require other approaches as the stack at the state of an error may not hold semantically important information. A way to handle such cases has been introduced to standard libraries, for example in Scala, the Try and - to some extent - Option constructs help programmers. Since these display monadic behavior, they provide improved composability compared to exception-based methods. Measuring software complexity can be done using software metrics. There are several well-known definitions: lines of code, cyclomatic complexity or McCabe-metrics, Halstead complexity measures and A-V. In this paper, we use definitions of widely-known metrics that have been extended for the case of exception handling and compare complexity of monadic error handling with standard exception handling techniques.

Read the paper · More papers on PaperTik