skip to main content
research-article

Developing and debugging algebraic specifications for Java classes

Published:27 June 2008Publication History
Skip Abstract Section

Abstract

Modern programs make extensive use of reusable software libraries. For example, a study of a number of large Java applications shows that between 17% and 30% of the classes in those applications use container classes defined in the java.util package. Given this extensive code reuse in Java programs, it is important for the interfaces of reusable classes to be well documented. An interface is well documented if it satisfies the following requirements: (1) the documentation completely describes how to use the interface; (2) the documentation is clear; (3) the documentation is unambiguous; and (4) any deviation between the documentation and the code is machine detectable. Unfortunately, documentation in natural language, which is the norm, does not satisfy the above requirements. Formal specifications can satisfy them but they are difficult to develop, requiring significant effort on the part of programmers.

To address the practical difficulties with formal specifications, we describe and evaluate a tool to help programmers write and debug algebraic specifications. Given an algebraic specification of a class, our interpreter generates a prototype that can be used within an application like a regular Java class. When running an application that uses the prototype, the interpreter prints error messages that tell the developer in which way the specification is incomplete or inconsistent with a hand-coded implementation of the class. We use case studies to demonstrate the usefulness of our system.

References

  1. AsmL. //http://research.microsoft.com/fse/asml. Version 2.2.]]Google ScholarGoogle Scholar
  2. Ammons, G., Mandein, D., Bodik, R., and Larus, J. 2003. Debugging Temporal Spicifications with Concept Analysis. In ACM SIGPLAN 2003 Confeerence on Programming Language Desing and Implementation. San Diego, California.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Antoy, S. and Hamlet, D. 2000. Automatically cheeking an implementation against its formal specification. IEEE Trans. Softw. Eng. 26, 1 (Jan).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Apache Software Foundation. 2003. BCEL—byte code engineering library. http://jakarta.apache.org/bcel/.]]Google ScholarGoogle Scholar
  5. Barnett, M., Grieskamp, W., Nachmanson, L., Schulte, W., Tillmann, N., and Veanes, M. 2003. Model-based testing with AsmL.NET. In Proceedings of the 1st European Conference on Model-Driven Software Engineering (Dec.)]]Google ScholarGoogle Scholar
  6. Beck, K. 2000. Extreme Programming Explained. Addison Wesley.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Beck, K. 2003. Test Driven Development, First ed. Addison-Wesley.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Chen, H. Y., Tse, T. H., Chan, F. T., and Chen, T. Y. 1998. In black and white: An integrated approach to class-level testing of object oriented programs. ACM Trans. Softw. Eng. 7, 3 (July).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Chen, H. Y., Tse, T. H., and Chen, T. Y. 2001. TACCLE: A methodology for object-oriented software testing at the class and cluster levels. ACM Trans. Softw. Eng. 10, 4 (Jan.), 56--109.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Dershowitz, N. and Plaisted, D. A. 2001. Handbook of Automated Reasoning. Vol. 1. Elsevier.]]Google ScholarGoogle Scholar
  11. Dershowitz, N. and Vigneron, L. 2003. Database of rewriting systems. http://www.loria.fr/vigneron/RewritingHP/systems.html.]]Google ScholarGoogle Scholar
  12. Doong, R. and Frankl, P. G. 1994. The ASTOOT approach to testing object-oriented programs. ACM Trans. Softw. Eng. 3, 2 (Apr.).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Futatsugi, K. 2003. CafeObj official homepage. http://www.ldl.jaist.ac.jp/cafeobj/.]]Google ScholarGoogle Scholar
  14. Gannon, J., McMullin, P., and Hamlet, R. 1981. Data-abstraction implementation, specification and testing. ACM Trans. Prog. Lang. Syst. 3, 3, 211--223.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Goguen, J. 2000. Software Engineering with OBJ: Algebraic Specifications in Action. Kluwer.]]Google ScholarGoogle Scholar
  16. Goguen, J. and Meseguer, J. 1982. Rapid prototyping: in the obj executable specification language. SIGSOFT Softw. Eng. Notes 7, 5, 75--84.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Goguen, J., Winkler, T., Meseguer, J., Futatsugi, K., and Jouannaud, J.-P. 1993. Introducing OBJ. In Applications of Algebraic Specification using OBJ, J. Goguen, Ed. Cambridge.]]Google ScholarGoogle Scholar
  18. Guttag, J. V. and Horning, J. J. 1978. The algebraic specification of abstract data types. Acta Informatica 10, 27--52.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Henkel, J. and Diwan, A. 2003. Discovering algebraic specifications from Java classes. In ECOOP 2003—Object-Oriented Programming, 17th European Conference, L. Cardelli, Ed. Springer, Darmstadt.]]Google ScholarGoogle Scholar
  20. Henkel, J. and Diwan, A. 2004a. Case study: Debugging a discovered specification for java.util.arraylist by using algebraic interpretation. Tech. Rep. CU-CS-970-04, University of Colorado at Boulder.]]Google ScholarGoogle Scholar
  21. Henkel, J. and Diwan, A. 2004b. A tool for writing and debugging algebraic specifications. In Proceedings of the 26th International Conference on Software Engineering (ICSE).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Hughes, M. and Stotts, D. 1996. Daistish: Systematic algebraic testing for OO programs in the presence of side-effects. In Proceedings of the International Symposium on Software Testing and Verification. San Diego, California.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Jackson, D. 2002. Alloy: a lightweight object modelling notation. Softw. Eng. Meth. 11, 2, 256--290.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Jackson, D. and Vaziri, M. 2000. Finding bugs with a constraint solver. In ISSTA '00: Proceedings of the 2000 ACM SIGSOFT International Symposium on Software Testing and Analysis. ACM Press, New York, NY, USA, 14--25.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Klop, J. W. 1992. Term rewriting systems. In Handbook of Logic in Computer Science, S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, Eds. Vol. 2. Oxford University Press, Oxford, Chapter 1, 1--117.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Knuth, D. and Bendix, P. 1970. Simple word problems in universal algebras. In Computational Problems in Abstract Algebra, J. Leech, Ed. Pergamon Press, Oxford, 263--297.]]Google ScholarGoogle Scholar
  27. Kupferman, O. and Vardi, M. Y. 1999. Vacuity detection in temporal model checking. In Correct Hardware Design and Verification Methods, Proceedings of the 10th IFIPWG10.5 Advanced Research Working Conference (CHARME'99). Springer, 82--96.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Marinov, D. and Khurshid, S. 2002. VAlloy: Virtual functions meet a relational language. In FME 2002: Formal Methods—Getting IT Right. Springer.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Mitchell, J. C. 1996. Foundations of Programming Languages. MIT Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Rapanotti, L. and Socorro, A. 1992. Introducing FOOPS. Tech. rep. PRG-TR-28-92, Programming Research Group, Oxford University Computing Laboratory, Oxford.]]Google ScholarGoogle Scholar
  31. Sankar, S. 1991. Run-time consistency checking of algebraic specifications. In Proceedings of the Symposium on Testing, Analysis, and Verification. Victoria, British Columbia, Canada.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Shlyakhter, I., Seater, R., Jackson, D., Sridharan, M., and Taghdiri, M. 2003. Debugging overconstrained declarative models using unsatisfiable cores. In 18th IEEE International Conference on Automated Software Engineering (ASE 2003), 6--10 October 2003, Montreal, Canada. IEEE Computer Society, 94--105.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Shlyakhter, I., Sridharan, M., and Jackson, D. 2002. Analyzing Distributed Algorithms with First-Order Logic. http://sdg.csail.mit.edu/pubs/2002/alloy-distalg.pdf.]]Google ScholarGoogle Scholar
  34. TeReSe. 2003. Term Rewriting Systems. Cambridge Tracts in Theoretical Computer Science, vol. 55. Cambridge University Press.]]Google ScholarGoogle Scholar
  35. Thatcher, J. W., Wagner, E. G., and Wright, J. B. 1982. Data type specification: Parameterization and the power of specification techniques. ACM Trans. Program. Lang. Syst. 4, 4 (Oct.).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Vallée-Rai, R., Gagnon, E., Hendren, L. J., Lam, P., Pominville, P., and Sundaresan, V. 2000. Optimizing Java bytecode using the Soot framework: Is it feasible? In Compiler Construction, 9th International Conference (CC 2000). 18--34.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. van den Brand, M. G. J., Heering, J., Klint, P., and Olivier, P. A. 2002. Compiling language definitions: The asf+sdf compiler. ACM Trans. Program. Lang. Syst. 24, 4, 334--368.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Wang, Y. and Parnas, D. L. 1994. Simulating the behavior of Software modules by trace rewriting. ACM Trans. Soft. Eng. 20, 10 (Oct.).]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Developing and debugging algebraic specifications for Java classes

      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 Transactions on Software Engineering and Methodology
        ACM Transactions on Software Engineering and Methodology  Volume 17, Issue 3
        June 2008
        133 pages
        ISSN:1049-331X
        EISSN:1557-7392
        DOI:10.1145/1363102
        Issue’s Table of Contents

        Copyright © 2008 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 27 June 2008
        • Accepted: 1 April 2007
        • Revised: 1 June 2006
        • Received: 1 September 2004
        Published in tosem Volume 17, Issue 3

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article
        • Research
        • Refereed

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader