skip to main content
research-article

On the use of type predicates in object-oriented software: the case of smalltalk

Published:14 October 2014Publication History
Skip Abstract Section

Abstract

Object-orientation relies on polymorphism to express behavioral variants. As opposed to traditional procedural design, explicit type-based conditionals should be avoided. This message is conveyed in introductory material on object orientation, as well as in object-oriented reengineering patterns. Is this principle followed in practice? In other words, are type predicates actually used in object-oriented software, and if so, to which extent?

Answering these questions will assist practitioners and researchers with providing information about the state of the practice, and informing the active research program of retrofitting type systems, clarifying whether complex flow-sensitive typing approaches are necessary. Other areas, such as refactoring and teaching object orientation, can also benefit from empirical evidence on the matter.

We report on a study of the use of type predicates in a large base of over 4 million lines of Smalltalk code. Our study shows that type predicates are in fact widely used to do explicit type dispatch, suggesting that flow-sensitive typing approaches are necessary for a type system retrofitted for a dynamic object-oriented language.

References

  1. J. Aldrich, J. Sunshine, D. Saini, and Z. Sparks. Typestate-oriented programming. In Proceedings of Onward!, pages 1015--1022. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. N. E. Beckman, D. Kim, and J. Aldrich. An empirical study of object protocols in the wild. In Mezini {17}, pages 2--26. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. K. Bierhoff and J. Aldrich. Modular typestate checking of aliased objects. In Proceedings of the 22nd ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2007), pages 301--320, Montreal, Canada, Oct. 2007. ACM Press. ACM SIGPLAN Notices, 42(10). Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. J. Bloch. Effective Java, 2nd Edition. Addison-Wesley, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. O. Callau, R. Robbes, E. Tanter, and D. Rothlisberger. How (and why) developers use the dynamic features of programming languages: the case of Smalltalk. Empirical Software Engineering, 2012. Online First. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. P. Chalin and P. R. James. Non-null references by default in java: Alleviating the nullity annotation burden. In ECOOP 2007: Proceedings of the 21st European Conference on Object-Oriented Programming, pages 227--247, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. W. R. Cook. On understanding data abstraction, revisited. ACM SIGPLAN Notices, 44(10):557--572, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R. DeLine and M. Fahndrich. Typestates for objects. In M. Odersky, editor, Proceedings of the 18th European Conference on Object-Oriented Programming (ECOOP 2004), number 3086 in Lecture Notes in Computer Science, pages 465--490, Oslo, Norway, June 2004. Springer-Verlag.Google ScholarGoogle ScholarCross RefCross Ref
  9. M. Fahndrich and K. R. M. Leino. Declaring and checking non-null types in an object-oriented language. In R. Crocker and G. L. Steele, Jr., editors, Proceedings of the 18th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2003), pages 302--312, Anaheim, CA, USA, Oct. 2003. ACM Press. ACM SIGPLAN Notices, 38(11). Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Fowler. Refactoring: improving the design of existing code. Addison-Wesley Professional, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. A. Guha, C. Saftoiu, and S. Krishnamurthi. Typing local control and state using flow analysis. In G. Barthe, editor, Proceedings of the 20th European Symposium on Programming (ESOP 2011), volume 6602 of Lecture Notes in Computer Science, pages 256--275. Springer-Verlag, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Krishnamurthi, M. Felleisen, and D. P. Friedman. Synthesizing object-oriented and functional design to promote re-use. In Proceedings of the 12th European Conference on Object-Oriented Programming, ECOOP '98, pages 91--113, London, UK, UK, 1998. Springer-Verlag. ISBN 3-540-64737-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. G. Laforge. Whats new in Groovy 2.0? http://www.infoq.com/articles/new-groovy-20, 2012.Google ScholarGoogle Scholar
  14. M. Lungu, R. Robbes, and M. Lanza. Recovering inter-project dependencies in software ecosystems. In ASE'10: Proceedings of the 25th IEEE/ACM international conference on Automated Software Engineering, ASE '10, pages 309--312, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. D. Malayeri and J. Aldrich. Is structural subtyping useful? an empirical study. In G. Castagna, editor, Proceedings of the 18th European Symposium on Programming (ESOP 2009), volume 5502 of Lecture Notes in Computer Science, pages 95--111. Springer-Verlag, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. Meyers. Effective C++: 55 Specific Ways to Improve Your Programs and Designs (3rd Edition). Addison-Wesley, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Mezini, editor. Proceedings of the 25th European Conference on Object-Oriented Programming (ECOOP 2011), volume 6813 of Lecture Notes in Computer Science, Lancaster, UK, July 2011. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. O. Nierstrasz, S. Ducasse, and S. Demeyer. Object-Oriented Reengineering Patterns. Square Bracket Associates, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. B. C. Oliveira. Modular visitor components. In Proceedings of the 23rd European Conference on ECOOP 2009 -- Object-Oriented Programming, Genoa, pages 269--293, Berlin, Heidelberg, 2009. Springer-Verlag. ISBN 978-3-642-03012-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. C. Parnin, C. Bird, and E. R. Murphy-Hill. Java generics adoption: how new features are introduced, championed, or ignored. In MSR 2011: Proceedings of the 8th International Working Conference on Mining Software Repositories, pages 3--12, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Pearce. Sound and complete flow typing with unions, intersections and negations. In R. Giacobazzi, J. Berdine, and I. Mastroeni, editors, Verification, Model Checking, and Abstract Interpretation, volume 7737 of Lecture Notes in Computer Science, pages 335--354. Springer Berlin Heidelberg, 2013.Google ScholarGoogle Scholar
  22. D. J. Pearce. A calculus for constraint-based flow typing. In Proceedings of the 15th Workshop on Formal Techniques for Java-like Programs, FTfJP '13, pages 7:1--7:7, 2013. ISBN 978-1-4503-2042-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. D. J. Pearce and J. Noble. Implementing a language with flow-sensitive and structural typing on the JVM. Electronic Notes in Theoretical Computer Science, 279(1):47 -- 59, 2011. ISSN 1571-0661. Proceedings of the Bytecode 2011 workshop, the Sixth Workshop on Bytecode Semantics, Verification, Analysis and Transformation. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. D. Posnett, V. Filkov, and P. Devanbu. Ecological inference in empirical software engineering. In Proceedings of the 26th ACM/IEEE International Conference on Automated Software Engineering (ASE 2011), pages 362--371, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. R. Robbes, D. Rothlisberger, and E. Tanter. Extensions during software evolution: Do objects meet their promise? In J. Noble, editor, Proceedings of the 26th European Conference on Object-oriented Programming (ECOOP 2012), Lecture Notes in Computer Science, pages 28--52, Beijing, China, June 2012. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. D. Roberts, J. Brant, and R. Johnson. A refactoring tool for smalltalk. Theor. Pract. Object Syst., 3(4):253--263, Oct. 1997. ISSN 1074-3227. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. R. E. Strom and S. Yemini. Typestate: A programming language concept for enhancing software reliability. IEEE Transactions on Software Engineering, 12(1):157--171, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. E. D. Tempero, C. Anslow, J. Dietrich, T. Han, J. Li, M. Lumpe, H. Melton, and J. Noble. The qualitas corpus: A curated collection of java code for empirical studies. In APSEC 2010: Proceedings of the 17th Asia Pacific Software Engineering Conference, pages 336--345, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. A. Thies and E. Bodden. Refaflex: Safer refactorings for reflective java programs. In Proceedings of the 2012 International Symposium on Software Testing and Analysis, ISSTA 2012, pages 1--11, 2012. ISBN 978-1-4503-1454-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. S. Tobin-Hochstadt. Typed Scheme: From Scripts to Programs. PhD thesis, Northeastern University, Jan. 2010.Google ScholarGoogle Scholar
  31. S. Tobin-Hochstadt and M. Felleisen. The design and implementation of Typed Scheme. In Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2008), pages 395--406, San Francisco, CA, USA, Jan. 2008. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. S. Tobin-Hochstadt and M. Felleisen. Logical types for untyped languages. In Proceedings of the 15th ACM SIGPLAN Conference on Functional Programming (ICFP 2010), pages 117--128, Baltimore, Maryland, USA, Sept. 2010. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. M. Torgersen. The expression problem revisited four new solutions using generics. In In Proceedings of the 18th European Conference on Object-Oriented Programming, pages 123--143. Springer-Verlag, 2004.Google ScholarGoogle Scholar
  34. J. Winther. Guarded type promotion: Eliminating redundant casts in Java. In Proceedings of the 13th Workshop on Formal Techniques for Java-Like Programs, FTfJP '11, pages 6:1--6:8, 2011. ISBN 978-1- 4503-0893-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. R. Wolff, R. Garcia, E. Tanter, and J. Aldrich. Gradual typestate. In Mezini {17}, pages 459--483. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. M. Zenger and M. Odersky. Independently extensible solutions to the expression problem. In In Proc. FOOL 12, 2005.Google ScholarGoogle Scholar

Index Terms

  1. On the use of type predicates in object-oriented software: the case of smalltalk

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 50, Issue 2
      DLS '14
      February 2015
      146 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2775052
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        DLS '14: Proceedings of the 10th ACM Symposium on Dynamic languages
        October 2014
        160 pages
        ISBN:9781450332118
        DOI:10.1145/2661088

      Copyright © 2014 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 14 October 2014

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!