Challenging Analytical Knowledge On Exception-Handling: An Empirical Study of 32 Java Software Packages

In this paper, we aim at contributing to the body of knowledge on exception-handling. We take neither an analytical approach (``we think exception handling is good because X and Y'') nor an empirical approach (``most developers do Z and T''). Our method is to compare analytical knowledge against empirical one. We first review the literature to find analytical knowledge on exception handling, we then set up a dataset of 32 Java software applications and an experimental protocol to statically characterize and measure the exception handling design. We eventually compare our measures against the claims on exception handling that authors have made over time. Our results show that some analytical principles for exception design do not support the empirical validation: 1) practitioners violate the principle and 2) upon analysis, there are indeed very good use cases going against this principle. This is in particular the case for ``Empty Catch Blocks are Bad'' and ``Do not Catch Generic Exceptions''.

[1]  Joseph Kiniry Exceptions in Java and Eiffel: Two Extremes in Exception Design and Application , 2006, Advanced Topics in Exception Handling Techniques.

[2]  Valerio Schiavoni,et al.  A component‐based middleware platform for reconfigurable service‐oriented architectures , 2012, Softw. Pract. Exp..

[3]  Paulo Marques,et al.  Exception Handling: A Field Study in Java and .NET , 2007, ECOOP.

[4]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[5]  John B. Goodenough,et al.  Exception handling: issues and a proposed notation , 1975, CACM.

[6]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[7]  Jonathan I. Maletic,et al.  An XML-based lightweight C++ fact extractor , 2003, 11th IEEE International Workshop on Program Comprehension, 2003..

[8]  Chen Fu,et al.  Exception-Chain Analysis: Revealing Exception Handling Architecture in Java Server Applications , 2007, 29th International Conference on Software Engineering (ICSE'07).

[9]  Robert C. Martin Clean Code - a Handbook of Agile Software Craftsmanship , 2008 .

[10]  Guy L. Steele,et al.  Java(TM) Language Specification, The (3rd Edition) (Java (Addison-Wesley)) , 2005 .

[11]  C Haythornwaite,et al.  Gamma, E., Helm, R., Johnson, R. & Vlissides, J. Design Patterns: Elements of Reusable Object Oriented Software. New York: Addison-Wesley, 1995. , 2002 .

[12]  Paul Rovner Extending Modula-2 to Build Large, Integrated Systems , 1986, IEEE Software.

[13]  Rebecca Wirfs-Brock Toward Exception-Handling Best Practices and Patterns , 2006, IEEE Software.