Empirical Software Engineering

, Volume 21, Issue 2, pp 483–516

Understanding and addressing exhibitionism in Java empirical research about method accessibility

  • Santiago A. Vidal
  • Alexandre Bergel
  • Claudia Marcos
  • J. Andrés Díaz-Pace
Article

DOI: 10.1007/s10664-015-9365-9

Cite this article as:
Vidal, S.A., Bergel, A., Marcos, C. et al. Empir Software Eng (2016) 21: 483. doi:10.1007/s10664-015-9365-9

Abstract

Information hiding is a positive consequence of properly defining component interfaces. Unfortunately, determining what should constitute a public interface remains difficult. We have analyzed over 3.6 million lines of Java open-source code and found that on the average, at least 20 % of defined methods are over-exposed, thus threatening public interfaces to unnecessary exposure. Such over-exposed methods may have their accessibility reduced to exactly reflect the method usage. We have identified three patterns in the source code to identify over-exposed methods. We also propose an Eclipse plugin to guide practitioners in identifying over-exposed methods and refactoring their applications. Our plugin has been successfully used to refactor a non-trivial application.

Keywords

Method accessibility Information hiding 

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  • Santiago A. Vidal
    • 1
  • Alexandre Bergel
    • 2
  • Claudia Marcos
    • 3
  • J. Andrés Díaz-Pace
    • 1
  1. 1.ISISTAN, UNICEN, Argentina and CONICETTandilArgentina
  2. 2.Pleiad Lab, Department of Computer Science (DCC)University of ChileSantiagoChile
  3. 3.ISISTAN, UNICEN, Argentina and CICBuenos AiresArgentina