Moonstone:
Support for Understanding and Writing Exception Handling Code

Florian Kistner, Mary Beth Kery, Michael Puskas, Steven Moore, Brad A. Myers

IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC), 2017

Exception handling in Java is often prone to mistakes. Studies have found that programmers make a number of common bad-practices and misjudgments when it comes to error handling. Moonstone is a research prototype and plug-in for Eclipse designed to guide users to reason about error paths, and help them avoid bad practices.

The official acronym for Moonstone is “Making Object Oriented Novel Software Tools Optimized for Noting Exceptions.” A moonstone is also a type of gemstone, shown on the right.

Abstract

Moonstone is a new plugin for Eclipse that supports developers in understanding exception flow and in writing exception handlers in Java. Understanding exception control flow is paramount for writing robust exception handlers, a task many developers struggle with. To help with this understanding, we present two new kinds of information: ghost comments, which are transient overlays that reveal potential sources of exceptions directly in code, and annotated highlights of skipped code and associated handlers. To help developers write better handlers, Moonstone additionally provides project-specific recommendations, detects common bad practices, such as empty or inadequate handlers, and provides automatic resolutions, introducing programmers to advanced Java exception handling features, such as try-with-resources. We present findings from two formative studies that informed the design of Moonstone. We then show with a user study that Moonstone improves users’ understanding in certain areas and enables developers to amend exception handling code more quickly and correctly.

Paper Preprint PDF Full-Text

Citation

@inproceedings{Kistner-VLHCC17-Moonstone,
  Title = {\textsc{Moonstone:} Support for Understanding and Writing Exception Handling Code},
  Author = {Florian Kistner and Mary Beth Kery and Michael Puskas and Steven Moore and Brad A. Myers},
  Booktitle = {2017 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC '17)},
  Month = Oct,
  Year = {2017},
  Address = {Raleigh, NC, USA},
  Pages = {63--71}
}

Florian Kistner, Mary Beth Kery, Michael Puskas, Steven Moore, Brad A. Myers, “Moonstone: Support for Understanding and Writing Exception Handling Code,” 2017 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC’17), October 2017, Raleigh, NC, USA, pp. 63–71.

Sponsors

This work was supported by a fellowship within the FITweltweit program of the German Academic Exchange Service (DAAD) and the National Science Foundation, Grant. No. CNS-1423054. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect those of the sponsors.

ACM Mary Beth Kery, Claire Le Goues, Brad A. Myers. “Examining programmer practices for locally handling exceptions.” Proceedings of the 13th International Conference on Mining Software Repositories. ACM, 2016.

References

[1]  M. P. Robillard and G. C. Murphy, “Static analysis to support the evolution of exception structure in object-oriented systems,”
ACM Trans. Softw. Eng. Methodol., vol. 12, no. 2, pp. 191–221, 2003.
[2]  B. Cabral and P. Marques, “Exception handling: A field study in java and .NET,”
in European conference on object-oriented programming 2007 (ecoop ’07), 2007, pp. 151–175.
[3]  F. Ebert, F. Castor, and A. Serebrenik, “An exploratory study on exception handling bugs in java programs,”
Journal of Systems and Software, vol. 106, pp. 82–101, 2015.
[4]  M. B. Kery, C. Le Goues, and B. A. Myers, “Examining programmer practices for locally handling exceptions,”
in Proceedings of the 13th international conference on mining software repositories (msr ’16), 2016, pp. 484–487.
[5]  H. Shah, C. Gorg, and M. J. Harrold, “Understanding exception handling: Viewpoints of novices and experts,”
IEEE Transactions on Software Engineering, vol. 36, no. 2, pp. 150–161, 2010.
[6]  H. Shah and M. J. Harrold, “Exception handling negligence due to intra-individual goal conflicts,”
in Proceedings of the 2009 icse workshop on cooperative and human aspects on software engineering (chase ’09), 2009, pp. 80–83.
[7]  A. P. Black, “Exception handling: The case against,” PhD thesis, University of Oxford, 1982.
[8]  B. Eckel, “Does java need checked exceptions?” 2001.
[9]  M. Kechagia and D. Spinellis, “Undocumented and unchecked: Exceptions that spell trouble,”
in Proceedings of the 11th working conference on mining software repositories (msr ’14), 2014, pp. 312–315.
[10]  D. Reimer and H. Srinivasan, “Analyzing exception usage in large java applications,”
in Proceedings of ecoop’2003 workshop on exception handling in object-oriented systems, 2003, pp. 10–18.
[11]  R. Rashkovits and I. Lavy, “Students’ misconceptions of java exceptions,”
in Proceedings of the 7th mediterranean conference on information systems (mcis ’12), 2012, pp. 1–21.
[12]  M. Asaduzzaman, M. Ahasanuzzaman, C. K. Roy, and K. A. Schneider, “How developers use exception handling in java?”
in Proceedings of the 13th international conference on mining software repositories (msr ’16), 2016, pp. 516–519.
[13]  M. P. Robillard and G. C. Murphy, “Analyzing exception flow in java programs,”
SIGSOFT Softw. Eng. Notes, vol. 24, no. 6, pp. 322–337, 1999.
[14]  H. Shah, C. Görg, and M. J. Harrold, “Visualization of exception handling constructs to support program understanding,”
in Proceedings of the 4th acm symposium on software visualization (softvis ’08), 2008, pp. 19–28.
[15]  E. A. Barbosa, “Mastering global exceptions with policy-aware recommendations,”
in Proceedings of the 37th international conference on software engineering (icse ’15), 2015, vol. 2, pp. 778–780.
[16]  D. Malayeri and J. Aldrich, “Practical exception specifications,”
in Advanced topics in exception handling techniques, 2006, pp. 200–220.
[17]  B.-M. Chang, J.-W. Jo, and S. H. Her, “Visualization of exception propagation for java using static analysis,”
in Proceedings. Second ieee international workshop on source code analysis and manipulation, 2002, pp. 173–182.
[18]  R. A. Maxion and R. T. Olszewski, “Improving software robustness with dependability cases,”
in Digest of papers. Twenty-eighth annual international symposium on fault-tolerant computing, 1998, pp. 346–355.
[19]  N. Ayewah, W. Pugh, J. D. Morgenthaler, J. Penix, and Y. Zhou, “Evaluating static analysis defect warnings on production software,” in Proceedings of the 7th acm sigplan-sigsoft workshop on program analysis for software tools and engineering (paste ’07), 2007, pp. 1–8.
[20]  V. Raychev, M. Vechev, and E. Yahav, “Code completion with statistical language models,”
in Proceedings of the 35th acm sigplan conference on programming language design and implementation (pldi ’14), 2014, pp. 419–428.
[21]  E. A. Barbosa, A. Garcia, and M. Mezini, “Heuristic strategies for recommendation of exception handling code,”
in 26th brazilian symposium on software engineering, 2012, pp. 171–180.
[22]  B. Ruzek, “Effective java exceptions,” 2007. [Online].
Available: https://oracle.com/technetwork/java/effective-exceptions-092345.html.
[23]  J. Schwille, “Use and abuse of exceptions — 12 guidelines for proper exception handling,”
in 12th ada-europe international conference (ada–europe ’93), 1993, pp. 142–152.
[24]  H. Shah, C. Görg, and M. J. Harrold, “Why do developers neglect exception handling?”
in Proceedings of the 4th international workshop on exception handling (weh ’08), 2008, pp. 62–68.
[25]  D. Geer, “Eclipse becomes the dominant java ide,”
Computer, vol. 38, no. 7, pp. 16–18, 2005.
[26]  R. L. Shackelford and A. N. Badre, “Why can’t smart students solve simple programming problems?”
International Journal of Man-Machine Studies, vol. 38, no. 6, pp. 985–997, 1993.

 

© 2017 IEEE / Carnegie Mellon University. All rights reserved.