Skip to main content
Log in

Understanding and addressing exhibitionism in Java empirical research about method accessibility

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6

Similar content being viewed by others

Notes

  1. http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

  2. http://bit.ly/mseFiles

  3. http://ss3.gemstone.com/ss/SPIRIT.html

  4. http://www.moosetechnology.org

  5. http://www.moosetechnology.org/tools/verveinej

  6. http://www.itracker.org

  7. http://oreports.com/

  8. http://archive.eso.org/cms/tools-documentation/jsky/

  9. Note that a private method cannot be overridden.

  10. These scatterplots are not reported in this paper.

  11. ArgoUML, SweetHome3D, FreeMind, Ant, Cobertura, Findbugs, Jajuk, JStock, PMD, TuxGuitar

  12. http://pmd.sourceforge.net

  13. http://checkstyle.sourceforge.net

  14. http://findbugs.sourceforge.net

  15. version Juno (4.2)

  16. version 9.0.4

  17. version 7.0.1

  18. This happens when you call a method that does not exist and you ask Eclipse to automatically generate the missing method.

  19. http://sites.google.com/site/santiagoavidal/projects/cover-methods

  20. Experiments were conducted on a MacBook Air, CPU 1.8 GHz Intel Core 5. 4Gb of memory.

  21. http://clustermines.sourceforge.net

  22. http://www.sweethome3d.com

  23. http://cobertura.sourceforge.net

  24. http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.4

  25. We obtained the value 35 % by computing the average of the IGAM metric from Fig. 3 in Zoller and Schmolitzky (2012).

References

  • Bacon DF, Sweeney PF (1996). In: Anderson L, Coplien J (eds) Fast static analysis of c++ virtual function calls. OOPSLA ACM, pp 324–341

  • 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

  • Booch G (2004) Object-Oriented Analysis and Design with Applications (3rd Edition). Addison Wesley Longman Publishing Co., Inc., Redwood

    Google Scholar 

  • 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–59

  • Briand LC, Wst J, Lounis H (1999) Using coupling measurement for impact analysis in object-oriented systems. In: ICSM, pp 475–482

  • 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 ’10

    Google Scholar 

  • Fowler M (2002) Public versus published interfaces. IEEE Softw 19(2):18–19

    Article  Google Scholar 

  • 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,. http://dl.acm.org/citation.cfm?id=2337223.2337249

  • 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

  • Martin RC (2002) Agile Software Development.Principles,Patterns, and Practices. Prentice-Hall

  • Meyer B (2009) Touch of class: learning to program well with objects and contracts, 1st edn. Springer Publishing Company, Incorporated

  • 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

  • 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, Austria

  • Parnas DL (1972) On the criteria to be used in decomposing systems into modules. CACM 15:1053–1058. doi:10.1145/361598.361623. http://www.cs.umd.edu/class/spring2003/cmsc838p/Design/criteria.pdf

    Article  Google Scholar 

  • Patenaude JF, Merlo E, Dagenais M (1999) Extending software quality assessment techniques to Java systems In: IWPC. IEEE Computer Society, Lagu, B, p 49

  • Riel A (1996) Object-oriented design heuristics. Addison Wesley, Boston

    Google Scholar 

  • 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. http://scg.unibe.ch/archive/papers/Rob12aAPIDeprecations.pdf, doi:10.1145/2393596.2393662, (to appear in print)

  • 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

    Article  Google Scholar 

  • Siegel S, Castellan NJ (1988) Nonparametric statistics for the behavioral sciences, 2nd edn. McGraw-Hill, New York

    Google Scholar 

  • 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–10

    Article  Google Scholar 

  • Singh V, Bhattacherjee V, Bhattacharjee S (2012) An analysis of dependency of coupling on software defects. ACM SIGSOFT Softw Eng. Notes 37(1):1–6

    Article  Google Scholar 

  • 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–443

  • 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–345

  • 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 2012

  • Wohlin C, Runeson P, Höst M, Ohlsson MC, Regnell B, Wesslén A (2000) Experimentation in software engineering: an introduction. Kluwer Academic Publishers, Norwell

    Book  MATH  Google Scholar 

  • 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

Download references

Acknowledgments

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.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Santiago A. Vidal.

Additional information

Communicated by: Arie van Deursen

Appendix:

Appendix:

Table 4 Library / Frameworks analyzed
Table 5 Library / Frameworks analyzed
Table 6 Applications analyzed
Table 7 Applications analyzed
Fig. 7
figure 7

Evolution of over-exposed methods

Fig. 8
figure 8

Evolution of over-exposed methods identified in the first version of each application

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Vidal, S.A., Bergel, A., Marcos, C. et al. Understanding and addressing exhibitionism in Java empirical research about method accessibility. Empir Software Eng 21, 483–516 (2016). https://doi.org/10.1007/s10664-015-9365-9

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10664-015-9365-9

Keywords

Navigation