skip to main content
research-article

Specification of generic APIs, or: why algebraic may be better than pre/post

Published:18 October 2014Publication History
Skip Abstract Section

Abstract

Specification based on Floyd-Hoare logic, using pre- and post-conditions, is common in languages aimed at high integrity software. Such pre/postcondition specifications are geared towards verification of code. While this specification technique has proven quite successful in the past 40 years, it has limitations when applied to API specification, particularly specification of generic interfaces.

API-oriented design and genericity is of particular importance in modern large-scale software development. In this situation, algebraic specification techniques have a significant advantage. Unlike pre/post-based specification, which deals with the inputs and outputs of one operation at a time, algebraic specification deals with the relationships between the different operations in an API, which is needed in the specification of generic APIs.

References

  1. A. L. Ambler, D. I. Good, J. C. Browne, W. F. Burger, R. M. Cohen, C. G. Hoch, and R. E. Wells. Gypsy: A language for specification and implementation of verifiable programs. In Proceedings of an ACM conference on Language design for reliable software, pages 1--10, New York, NY, USA, 1977. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. H. Bagge, V. David, and M. Haveraaen. Testing with axioms in C++n2011. Journal of Object Technology, 10:10:1--32, 2011.Google ScholarGoogle ScholarCross RefCross Ref
  3. A. H. Bagge and M. Haveraaen. Axiom-based transformations: Optimisation and testing. In J. J. Vinju and A. Johnstone, editors, Eighth Workshop on Language Descriptions, Tools and Applications (LDTA 2008), volume 238 of Electronic Notes in Theoretical Computer Science, pages 17--33, Budapest, Hungary, 2009. Elsevier. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. H. Bagge and M. Haveraaen. Interfacing concepts: Why declaration style shouldn't matter. In T. Ekman and J. J. Vinju, editors, Proceedings of the Ninth Workshop on Language Descriptions, Tools and Applications (LDTA '09), volume 253 of Electronic Notes in Theoretical Computer Science, pages 37--50, York, UK, 2010. Elsevier. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. J. Barnes. SPARK - The Proven Approach to High Integrity Software. Altran Praxis Ltd, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. Barnett, D. A. Naumann, W. Schulte, and Q. Sun. 99.44% pure: Useful abstractions in specifications. In 6th Workshop on Formal Techniques for Java-like Programs (FTfJP'2004), 2004.Google ScholarGoogle Scholar
  7. K. Claessen and J. Hughes. QuickCheck: A lightweight tool for random testing of Haskell programs. In ICFP '00: Proceedings of the fifth ACM SIGPLAN international conference on Functional programming, pages 268--279, New York, NY, USA, 2000. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R.-K. Doong and P. G. Frankl. The ASTOOT approach to testing object-oriented programs. ACM Trans. Softw. Eng. Methodol., 3(2):101--130, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. H. Ehrig and B. Mahr. Fundamentals of Algebraic Specification 1: Equations und Initial Semantics, volume 6 of EATCS Monographs on Theoretical Computer Science. Springer, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. C. Flanagan, K. R. M. Leino, M. Lillibridge, G. Nelson, J. B. Saxe, and R. Stata. Extended static checking for java. In Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation, PLDI '02, pages 234--245, New York, NY, USA, 2002. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. W. Floyd. Assigning meanings to programs. In Mathematical Aspects of Computer Science, volume 19 of Proceedings of Symposia in Applied Mathematics, pages 19--32. American Mathematical Society, 1967.Google ScholarGoogle Scholar
  12. J. D. Gannon, P. R. McMullin, and R. G. Hamlet. Data-abstraction implementation, specification, and testing. ACM Trans. Program. Lang. Syst., 3(3):211--223, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J. Goguen, J. Thatcher, and E. Wagner. An initial algebra approach to the specification, correctness and implementation of abstract data types. In R. Yeh, editor, Current Trends in Programming Methodology, volume 4, pages 80--149. Prentice Hall, 1978.Google ScholarGoogle Scholar
  14. J. Gosling, B. Joy, G. Steele, and G. Bracha. Java™ Language Specification, The (3rd Edition). Addison-Wesley Professional, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. P. Gottschling and A. Lumsdaine. Integrating semantics and compilation: Using C++ concepts to develop robust and efficient reusable libraries. In Y. Smaragdakis and J. G. Siek, editors, GPCE, pages 67--76. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. D. Gregor, J. Järvi, J. Siek, B. Stroustrup, G. Dos Reis, and A. Lumsdaine. Concepts: linguistic support for generic programming in C++. In OOPSLA '06: Proceedings of the 21st annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, pages 291--310, New York, NY, USA, 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. V. Guttag, J. J. Horning, and J. M. Wing. The Larch family of specification languages. IEEE Softw., 2(5):24--36, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Haveraaen and K. T. Kalleberg. JAxT and JDI: the simplicity of JUnit applied to axioms and data invariants. In OOPSLA Companion '08: Companion to the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications, pages 731--732, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. M. Haveraaen and E. G. Wagner. Guarded algebras: Disguising partiality so you won't know whether it's there. In Recent Trends In Algebraic Development Techniques, volume 1827 of Lecture Notes in Computer Science, pages 3--11. Springer-Verlag, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. C. A. R. Hoare. An axiomatic basis for computer programming. Commun. ACM, 12(10):576--580, 1969. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Kapur, D. R. Musser, and A. A. Stepanov. Tecton: A language for manipulating generic objects. In J. Staunstrup, editor, Program Specification, Proceedings of a Workshop, Lecture Notes in Computer Science, pages 402--414, Aarhus, Denmark, Aug. 1981. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. G. T. Leavens, A. L. Baker, and C. Ruby. Preliminary design of JML: A behavioral interface specification language for Java. SIGSOFT Software Engineering Notes, 31(3):1--38, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. K. R. M. Leino. Dafny: An automatic program verifier for functional correctness. In E. M. Clarke and A. Voronkov, editors, Logic for Programming, Artificial Intelligence, and Reasoning - 16th International Conference, LPAR-16, Dakar, Senegal, April 25-May 1, 2010, Revised Selected Papers, volume 6355 of Lecture Notes in Computer Science, pages 348--370. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. B. Liskov, R. R. Atkinson, T. Bloom, J. E. B. Moss, J. C. Schaffert, R. Scheifler, and A. Snyder. CLU Reference Manual, volume 114 of Lecture Notes in Computer Science. Springer-Verlag, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. B. Liskov and S. Zilles. Specification techniques for data abstractions. In Proceedings of the international conference on Reliable software, pages 72--87, New York, NY, USA, 1975. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. B. Meyer. Eiffel: The language. Prentice-Hall, Inc., Upper Saddle River, NJ, USA, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. P. D. Mosses. The use of sorts in algebraic specifications. In M. Bidoit and C. Choppy, editors, COMPASS/ADT, volume 655 of Lecture Notes in Computer Science, pages 66--92. Springer, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. D. R. Musser and A. A. Stepanov. Generic programming. In P. M. Gianni, editor, Symbolic and Algebraic Computation, International Symposium ISSAC'88, Rome, Italy, July 4-8, 1988, Proceedings, volume 358 of Lecture Notes in Computer Science, pages 13--25. Springer, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. G. J. Popek, J. J. Horning, B. W. Lampson, J. G. Mitchell, and R. L. London. Notes on the design of Euclid. In Proceedings of an ACM conference on Language design for reliable software, pages 11--18, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. D. Sannella and A. Tarlecki. Extended ML: An institution-independent framework for formal program development. In Proceedings of the Tutorial and Workshop on Category Theory and Computer Programming, pages 364--389, London, UK, 1986. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. D. Sannella and A. Tarlecki. Algebraic methods for specification and formal development of programs. ACM Comput. Surv., page 10, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M. Shaw, W. A. Wulf, and R. L. London. Abstraction and verification in Alphard: Defining and specifying iteration and generators. Commun. ACM, 20(8):553--564, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. SPARK Team. SPARK Generics - A User View. Technical Report S.P0468.42.25, Altran, January 2012. Draft.Google ScholarGoogle Scholar
  34. A. Stepanov and P. McJones. Elements of Programming. Addison-Wesley Professional, 1st edition, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. S. T. Taft, R. A. Duff, R. Brukardt, E. Plödereder, P. Leroy, and E. Schonberg. Ada 2012 Reference Manual. Language and Standard Libraries - International Standard ISO/IEC 8652/2012 (E), volume 8339 of Lecture Notes in Computer Science. Springer, 2013.Google ScholarGoogle Scholar
  36. X. Tang and J. Järvi. Concept-based optimization. In LCSD '07: Proceedings of the 2007 Symposium on Library-Centric Software Design, pages 97--108, New York, NY, USA, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Specification of generic APIs, or: why algebraic may be better than pre/post

            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 SIGAda Ada Letters
              ACM SIGAda Ada Letters  Volume 34, Issue 3
              HILT '14
              December 2014
              93 pages
              ISSN:1094-3641
              DOI:10.1145/2692956
              Issue’s Table of Contents
              • cover image ACM Conferences
                HILT '14: Proceedings of the 2014 ACM SIGAda annual conference on High integrity language technology
                October 2014
                116 pages
                ISBN:9781450332170
                DOI:10.1145/2663171

              Copyright © 2014 ACM

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 18 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!