Empirical Software Engineering

, Volume 21, Issue 2, pp 483–516 | Cite as

Understanding and addressing exhibitionism in Java empirical research about method accessibility

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


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.


Method accessibility Information hiding 



We thank Emmanuel Puybaret, principal author of SweetHome3D, for his feedback on our refactoring. We gratefully thank Romain Robbes and Renato Cerro for their feedback on an earlier draft of the manuscript. We also thank Hugo Manterola and Ignacio Orlando for contributing to the development of the plugin. We thank the anonymous reviewers for their comments and suggestions to improve the quality of this work. This work was partially supported by PIP Project 112-201101-00078 (CONICET) - Argentina.


  1. Bacon DF, Sweeney PF (1996). In: Anderson L, Coplien J (eds) Fast static analysis of c++ virtual function calls. OOPSLA ACM, pp 324–341Google Scholar
  2. Binkley D, Ceccato M, Harman M, Ricca F, Tonella P (2005) Automated refactoring of object oriented code into aspects In: Software Maintenance, 2005. ICSM’05. In: Proceedings of the 21st IEEE International Conference on, pp 27–36. doi: 10.1109/ICSM.2005.27
  3. Booch G (2004) Object-Oriented Analysis and Design with Applications (3rd Edition). Addison Wesley Longman Publishing Co., Inc., RedwoodGoogle Scholar
  4. Bouillon P, Grokinsky E, Steimann F (2008) Controlling accessibility in agile projects with the access modifier modifier. In: Paige RF, Meyer B (eds) TOOLS (46), Springer, Lecture Notes in Business Information Processing, vol 11, pp 41–59Google Scholar
  5. Briand LC, Wst J, Lounis H (1999) Using coupling measurement for impact analysis in object-oriented systems. In: ICSM, pp 475–482Google Scholar
  6. Chowdhury I, Zulkernine M (2010) Can complexity, coupling, and cohesion metrics be used as early indicators of vulnerabilities? In: Proceedings of the 2010 ACM Symposium on Applied Computing. ACM, New York, pp 1963–1969. SAC ’10Google Scholar
  7. Fowler M (2002) Public versus published interfaces. IEEE Softw 19(2):18–19CrossRefGoogle Scholar
  8. Ge Xi, DuBose QL, Murphy-Hill E (2012) Reconciling manual and automatic refactoring. In: Proceedings of the 2012 International Conference on Software Engineering, IEEE Press, Piscataway, NJ, USA, ICSE 2012, pp 211–221,.
  9. Liang D, Pennings M, Harrold MJ (2001) Extending and evaluating flow-insenstitive and context-insensitive points-to analyses for Java. In: Proceedings of the, 2001 ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering, ACM, New York, NY, USA, PASTE ’01, pp 73–79. doi: 10.1145/379605.379676
  10. Martin RC (2002) Agile Software Development.Principles,Patterns, and Practices. Prentice-HallGoogle Scholar
  11. Meyer B (2009) Touch of class: learning to program well with objects and contracts, 1st edn. Springer Publishing Company, IncorporatedGoogle Scholar
  12. Mockus A, Nagappan N, Dinh-Trong TT (2009) Test coverage and post-verification defects: A multiple case study. In: Proceedings of the 2009 3rd International Symposium on Empirical Software Engineering and Measurement, IEEE Computer Society, Washington, DC, USA, ESEM ’09, pp 291–301. doi: 10.1109/ESEM.2009.5315981
  13. Müller A (2010) Bytecode analysis for checking Java access modifiers. In: Work in Progress and Poster Session, 8th Int. Conf. on Principles and Practice of Programming in Java (PPPJ, 2010), Vienna, AustriaGoogle Scholar
  14. Parnas DL (1972) On the criteria to be used in decomposing systems into modules. CACM 15:1053–1058. doi: 10.1145/361598.361623. CrossRefGoogle Scholar
  15. Patenaude JF, Merlo E, Dagenais M (1999) Extending software quality assessment techniques to Java systems In: IWPC. IEEE Computer Society, Lagu, B, p 49Google Scholar
  16. Riel A (1996) Object-oriented design heuristics. Addison Wesley, BostonGoogle Scholar
  17. Robbes R, Lungu M, Roethlisberger D (2012) How do developers react to API deprecation? The case of a Smalltalk ecosystem. In: Proceedings of the 20th International Symposium on the Foundations of Software Engineering (FSE’12), pp 56:1–56:11., doi: 10.1145/2393596.2393662, (to appear in print)
  18. Schafer M, Thies A, Steimann F, Tip F (2012) A comprehensive approach to naming and accessibility in refactoring Java programs. IEEE Trans Softw Eng 38(6):1233–1257. doi: 10.1109/TSE.2012.13 CrossRefGoogle Scholar
  19. Siegel S, Castellan NJ (1988) Nonparametric statistics for the behavioral sciences, 2nd edn. McGraw-Hill, New YorkGoogle Scholar
  20. Singh S, Kahlo n KS (2011) Effectiveness of encapsulation and object-oriented metrics to refactor code and identify error prone classes using bad smells. ACM SIGSOFT Softw Eng Notes 36(5):1–10CrossRefGoogle Scholar
  21. Singh V, Bhattacherjee V, Bhattacharjee S (2012) An analysis of dependency of coupling on software defects. ACM SIGSOFT Softw Eng. Notes 37(1):1–6CrossRefGoogle Scholar
  22. Steimann F, Thies A (2009) From public to private to absent: Refactoring Java programs under constrained accessibility. In: Drossopoulou S (ed) Lecture Notes in Computer Science, vol 5653. ECOOP, Springer, pp 419–443Google Scholar
  23. Tempero E, Anslow C, Dietrich J, Han T, Li J, Lumpe M, Melton H, Noble J (2010) The qualitas corpus:A curated collection of Java code for empirical studies. In: Software Engineering Conference (APSEC), 2010 17th Asia Pacific, pp 336–345Google Scholar
  24. Thies A, Bodden E (2012) Refaflex: safer refactorings for reflective Java programs.In: Proceedings of the 2012 International Symposium on Software Testing and Analysis, ACM, New York, NY, USA, ISSTA 2012Google Scholar
  25. Wohlin C, Runeson P, Höst M, Ohlsson MC, Regnell B, Wesslén A (2000) Experimentation in software engineering: an introduction. Kluwer Academic Publishers, NorwellCrossRefzbMATHGoogle Scholar
  26. Zoller C, Schmolitzky A (2012) Measuring inappropriate generosity with access modifiers in Java systems. In: Proceedings of the 2012 Joint Conference of the 22Nd International Workshop on Software Measurement and the 2012 Seventh International Conference on Software Process and Product Measurement. doi: 10.1109/IWSM-MENSURA.2012.15. IEEE Computer Society, Washington, DC, USA, IWSM-MENSURA ’12, pp 43–52

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

Personalised recommendations