An Empirical Study of Object Protocols in the Wild

  • Nels E. Beckman
  • Duri Kim
  • Jonathan Aldrich
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6813)

Abstract

An active area of research in computer science is the prevention of violations of object protocols, i.e., restrictions on temporal orderings of method calls on an object. However, little is understood about object protocols in practice. This paper describes an empirical study of object protocols in some popular open-source Java programs. In our study, we have attempted to determine how often object protocols are defined, and how often they are used, while also developing a taxonomy of similar protocols. In the open-source projects in our study, comprising almost two million lines of code, approximately 7.2% of all types defined protocols, while 13% of classes were clients of types defining protocols. (For comparison, 2.5% of the types in the Java library define type parameters using Java Generics.) This suggests that protocol checking tools are widely applicable.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Acharya, M., Xie, T., Pei, J., Xu, J.: Mining API patterns as partial orders from source code: from usage scenarios to specifications. In: ESEC-FSE 2007, pp. 25–34. ACM Press, New York (2007)Google Scholar
  2. 2.
    Alur, R., Černý, P., Madhusudan, P., Nam, W.: Synthesis of interface specifications for java classes. In: POPL 2005, pp. 98–109. ACM Press, New York (2005)Google Scholar
  3. 3.
    Ball, T., Rajamani, S.K.: Automatically validating temporal safety properties of interfaces. In: Dwyer, M.B. (ed.) SPIN 2001. LNCS, vol. 2057, pp. 103–122. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  4. 4.
    Beckman, N.E., Bierhoff, K., Aldrich, J.: Verifying correct usage of atomic blocks and typestate. In: OOPSLA 2008. ACM Press, New York (2008)Google Scholar
  5. 5.
    Bierhoff, K., Aldrich, J.: Modular typestate checking of aliased objects. In: OOPSLA 2007, pp. 301–320. ACM Press, New York (2007)Google Scholar
  6. 6.
    Bierhoff, K., Aldrich, J.: Lightweight object specification with typestates. In: ESEC-FSE 2005, pp. 217–226 (September 2005)Google Scholar
  7. 7.
    Bierhoff, K., Beckman, N.E., Aldrich, J.: Practical API protocol checking with access permissions. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 195–219. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  8. 8.
    DeLine, R., Fähndrich, M.: Enforcing high-level protocols in low-level software. SIGPLAN Not. 36(5), 59–69 (2001)CrossRefGoogle Scholar
  9. 9.
    Dunfield, J., Pfenning, F.: Tridirectional typechecking. In: POPL 2004, pp. 281–292. ACM Press, New York (2004)Google Scholar
  10. 10.
    Fahndrich, M., Xia, S.: Establishing object invariants with delayed types. In: OOPSLA 2007, pp. 337–350. ACM Press, New York (2007)Google Scholar
  11. 11.
    Fairbanks, G., Garlan, D., Scherlis, W.: Design fragments make using frameworks easier. In: OOPSLA 2006, pp. 75–88. ACM Press, New York (2006)Google Scholar
  12. 12.
    Fink, S.J., Yahav, E., Dor, N., Ramalingam, G., Geay, E.: Effective typestate verification in the presence of aliasing. ACM Trans. Softw. Eng. Methodol. 17(2), 1–34 (2008)CrossRefGoogle Scholar
  13. 13.
    Foster, J.S., Johnson, R., Kodumal, J., Aiken, A.: Flow-insensitive type qualifiers. ACM Trans. Program. Lang. Syst. 28(6), 1035–1087 (2006)CrossRefGoogle Scholar
  14. 14.
    Gopinathan, M., Rajamani, S.K.: Enforcing object protocols by combining static and runtime analysis. In: OOPSLA 2008, pp. 245–260. ACM Press, New York (2008)Google Scholar
  15. 15.
    Heydarnoori, A., Czarnecki, K., Bartolomei, T.T.: Supporting framework use via automatically extracted concept-implementation templates. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 344–368. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  16. 16.
    Jaspan, C., Aldrich, J.: Checking framework interactions with relationships. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 27–51. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  17. 17.
    Joshi, P., Sen, K.: Predictive typestate checking of multithreaded Java programs. In: ASE 2008, pp. 288–296 (September 2008)Google Scholar
  18. 18.
    Kim, D.: An empirical study on the frequency and classification of object protocols in Java. Master’s thesis, Korea Advanced Institute of Science and Technology (2010)Google Scholar
  19. 19.
    Lam, P., Kuncak, V., Rinard, M.: Generalized typestate checking using set interfaces and pluggable analyses. SIGPLAN Not. 39(3), 46–55 (2004)CrossRefGoogle Scholar
  20. 20.
    Naeem, N.A., Lhotak, O.: Typestate-like analysis of multiple interacting objects. In: OOPSLA 2008, pp. 347–366. ACM Press, New York (2008)Google Scholar
  21. 21.
    Pradel, M., Bichsel, P., Gross, T.R.: A framework for the evaluation of specification miners based on finite state machines. In: ICSM (2010)Google Scholar
  22. 22.
    Qi, X., Myers, A.C.: Masked types for sound object initialization. In: POPL 2009, pp. 53–65. ACM Press, New York (2009)Google Scholar
  23. 23.
    Strom, R.E., Yemini, S.: Typestate: A programming language concept for enhancing software reliability. IEEE Trans. Softw. Eng. 12(1), 157–171 (1986)CrossRefMATHGoogle Scholar
  24. 24.
    Tempero, E., Anslow, C., Dietrich, J., Han, T., Li, J., Lumpe, M., Melton, H., Noble, J.: Qualitas corpus: A curated collection of Java code for empirical studies. In: 2010 Asia Pacific Software Engineering Conference (APSEC 2010) (December 2010) Corpus version 20090202rGoogle Scholar
  25. 25.
    Wasylkowski, A., Zeller, A., Lindig, C.: Detecting object usage anomalies. In: ESEC-FSE 2007, pp. 35–44. ACM Press, New York (2007)Google Scholar
  26. 26.
    Weimer, W., Necula, G.C.: Finding and preventing run-time error handling mistakes. SIGPLAN Not. 39(10), 419–431 (2004)CrossRefGoogle Scholar
  27. 27.
    Whaley, J., Martin, M.C., Lam, M.S.: Automatic extraction of object-oriented component interfaces. In: ISSTA 2002, pp. 218–228. ACM Press, New York (2002)Google Scholar
  28. 28.
    Zhong, H., Xie, T., Zhang, L., Pei, J., Mei, H.: MAPO: Mining and recommending API usage patterns. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 318–343. Springer, Heidelberg (2009)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Nels E. Beckman
    • 1
  • Duri Kim
    • 1
  • Jonathan Aldrich
    • 1
  1. 1.Carnegie Mellon UniversityPittsburghUSA

Personalised recommendations