Skip to main content
×
×
Home

An extended account of contract monitoring strategies as patterns of communication

  • CAMERON SWORDS (a1), AMR SABRY (a1) and SAM TOBIN-HOCHSTADT (a1)
Abstract

Contract systems have come to play a vital role in many aspects of software engineering. This has resulted in a wide variety of approaches to enforcing contracts—ranging from the straightforward pre-condition and post-condition checking of Eiffel to lazy, optional, and parallel enforcement strategies. Each of these approaches has its merits, but each has required ground-up development of an entire contract monitoring system. We present a unified approach to understanding this variety, while also opening the door to as-yet-undiscovered strategies. By observing that contracts are fundamentally about communication between a program and a monitor, we reframe contract checking as communication between concurrent processes. This brings out the underlying relations between widely studied enforcement strategies, including strict and lazy enforcement as well as concurrent approaches, including new contracts and strategies. We show how each of these can be embedded into a core calculus, and demonstrate a proof (via simulation) of correctness for one such encoding. Finally, we show that our approach suggests new monitoring approaches and contracts not previously expressible.

    • Send article to Kindle

      To send this article to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about sending to your Kindle. Find out more about sending to your Kindle.

      Note you can select to send to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be sent to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

      Find out more about the Kindle Personal Document Service.

      An extended account of contract monitoring strategies as patterns of communication
      Available formats
      ×
      Send article to Dropbox

      To send this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Dropbox.

      An extended account of contract monitoring strategies as patterns of communication
      Available formats
      ×
      Send article to Google Drive

      To send this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Google Drive.

      An extended account of contract monitoring strategies as patterns of communication
      Available formats
      ×
Copyright
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution, and reproduction in any medium, provided the original work is properly cited.
References
Hide All
Ahmed, A., Findler, R. B., Siek, J. G. & Wadler, P. (2011) Blame for all. In Proceedings of the 38th Annual Symposium on Principles of Programming Languages, POPL '11. ACM.
Ahmed, A., Jamner, D., Siek, J. G. & Wadler, P. (2017) Theorems for free for free: Parametricity, with and without types. In Proceedings of the 22th International Conference on Functional Programming, ICFP '17. ACM.
Ambler, A. L., Good, D. I., Browne, J. C., Burger, W. F., Choen, R. M., Hoch, C. G., & Wells, R. E. (1977) Gypsy: A language for specification and implementation of verifiable programs. In Proceedings of the ACM Conference on Language Design for Reliable Software, Sigplan, pp. 1–10.
Barnett, M., Leino, K. R. M. & Schulte, W. (2005) The spec# programming system: An overview. In Proceedings of the 2004 International Conference on Construction and Analysis of Safe, Secure, and Interoperable Smart Devices, CASSIS '04. Springer-Verlag.
Blume, M. & McAllester, D. (2004) A sound (and complete) model of contracts. In Proceedings of the 9th International Conference on Functional Programming, ICFP '04. ACM.
Chen, F. & Roşu, G. (2007) Mop: An efficient and generic runtime verification framework. In Proceedings of the 22nd Annual Conference on Object-Oriented Programming Systems and Applications, OOPSLA '07. ACM.
Chitil, O. (2012) Practical typed lazy contracts. In Proceedings of the 17th International Conference on Functional Programming, ICFP '12. ACM.
Chitil, O., & Huch, F. (2006) A pattern logic for prompt lazy assertions in haskell. In Proceedings of the Symposium on Implementation and Application of Functional Languages, IFL '06. Springer.
Chitil, O., McNeill, D. & Runciman, C. (2003) Lazy assertions. In Proceedings of the Symposium on Implementation and Application of Functional Languages, IFL '03. Springer-Verlag.
Degen, M., Thiemann, P. & Wehr, S. (2009) True Lies: Lazy contracts for lazy languages (faithfulness is better than laziness) In Proceedings of the Arbeitstagung Programmiersprachen (ATPS), ATPS '09. Springer.
Degen, M., Thiemann, P. & Wehr, S. (2010) Eager and delayed contract monitoring for call-by-value and call-by-name evaluation. J. Log. Algebr. Program. 79 (7), 515549.
Degen, M., Thiemann, P. & Wehr, S. (2012) The interaction of contracts and laziness. In Proceedings of the 2012 Workshop on Partial Evaluation and Program Manipulation, PEPM '12. ACM.
Dimoulas, C. & Felleisen, M. (2011) On contract satisfaction in a higher-order world. ACM Trans. Program. Lang. Syst. 33 (5), 16:116:29.
Dimoulas, C., Findler, R. B., Flanagan, C. & Felleisen, M. (2011) Correct blame for contracts: No more scapegoating. In Proceedings of the 38th Annual Symposium on Principles of Programming Languages, POPL '11. ACM.
Dimoulas, C., Findler, R. B. & Felleisen, M. (2013) Option contracts. In Proceedings of the 2013 International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA '13. ACM.
Dimoulas, C., Pucella, R. & Felleisen, M. (2009) Future contracts. In Proceedings of the 11th Conference on Principles and Practice of Declarative Programming, PPDP '09. ACM.
Dimoulas, C., Tobin-Hochstadt, S. & Felleisen, M. (2012) Complete monitors for behavioral contracts. In Proceedings of the European Symposium on Programming, ESOP '12. Springer-Verlag.
Disney, T., Flanagan, C. & McCarthy, J. (2011) Temporal higher-order contracts. In Proceedings of the 16th International Conference on Functional Programming, ICFP '11. ACM.
Ergün, F., Kannan, S., Kumar, S. R., Rubinfeld, R. & Viswanathan, M. (1998) Spot-checkers. In Proceedings of the 13th Annual ACM Symposium on Theory of Computing, STOC '98. ACM.
Findler, R. B. (2014) Behavioral software contracts. In Proceedings of the 19th International Conference on Functional Programming, ICFP '14. ACM.
Findler, R. B. & Blume, M. (2006) Contracts as pairs of projections. In Proceedings of the 8th International Conference on Functional and Logic Programming, FLOPS '06. Springer-Verlag.
Findler, R. B & Felleisen, M. (2002) Contracts for higher-order functions. In Proceedings of the 7th International Conference on Functional Programming, ICFP '02. ACM.
Findler, R. B., Guo, S.-Y. & Rogers, A. (2008) Lazy contract checking for immutable data structures. In Proceedings of the Implementation and Application of Functional Languages. Springer-Verlag.
Flanagan, C. (2006) Hybrid type checking. In Proceedings of the Conference Record of the 33rd Symposium on Principles of Programming Languages, POPL '06. ACM.
Flatt, M. & PLT. (2010) Reference: Racket. Technical Report, PLT-TR-2010-1. PLT Inc. http://racket-lang.org/tr1/.
Freeman, Tim. (1994) Refinement Types for ML. (Ph.D. Thesis), Carnegie Mellon University.
Friedman, D. & Wise, D. (1976) The Impact of Applicative Programming on Multiprocessing. Technical Report 52. Indiana University, Computer Science Department.
Greenberg, M. (2015) Space-efficient manifest contracts. In Proceedings of the 42nd Symposium on Principles of Programming Languages, POPL '15. ACM.
Greenberg, M., Pierce, B. C. & Weirich, S. (2010) Contracts made manifest. In Proceedings of the 37th Symposium on Principles of Programming Languages, POPL '10. ACM.
Guha, A., Matthews, J., Findler, R. B. & Krishnamurthi, S. (2007) Relationally-parametric polymorphic contracts. In Proceedings of the 2007 Symposium on Dynamic Languages, DLS '07. ACM.
Havelund, K. & Rosu, G. (2001) Monitoring Java Programs with Java Pathexplorer. Technical Report, NASA Ames Research Center.
Herman, D., Tomb, A. & Flanagan, C (2007 April) Space-efficient gradual typing. In Trends in Functional Prog, Page XXVIII. TFP '07.
Hickey, R. (2018) Clojure core.spec Documentation [online]. Accessed February 18, 2018. Available at: https://clojure.org/guides/spec.
Hinze, R., Jeuring, J. & Löh, A. (2006) Typed contracts for functional programming. In Proceedings of the 8th International Conference on Functional and Logic Programming, FLOPS '06. Springer-Verlag.
Ingerman, P. Z. (1961) Thunks: A way of compiling procedure statements with some comments on procedure declarations. Commun. ACM 4 (1).
Jeffrey, A. (1998) Semantics for core Concurrent ML using computation types. Higher Order Operational Techniques in Semantics. Cambridge University Press.
Keil, M. & Thiemann, P. (2015) Blame assignment for higher-order contracts with intersection and union. In Proceedings of the 20th International Conference on Functional Programming, ICFP '15. ACM.
Meyer, B. (1992) Eiffel: The Language. Prentice-Hall, Inc.
Moore, S., Dimoulas, C., Findler, R. B., Flatt, M. & Chong, S. (2016) Extensible access control with authorization contracts. In Proceedings of the 2016 International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA '16. ACM.
Nguyen, P. C., Tobin-Hochstadt, S. & Van Horn, D. (2014) Soft contract verification. In Proceedings of the 19th International Conference on Functional Programming, ICFP '14. ACM.
Ou, X., Tan, G., Mandelbaum, Y., & Walker, D. (2004) Dynamic typing with dependent types. Exploring New Frontiers of Theoretical Informatics, Levy, J.-J., Mayr, E. W., & Mitchell, J. C. (eds), Boston, MA: Springer, US, pp. 437450.
Owens, Z. (2012) Contract monitoring as an effect. Proceedings of the 1st ACM SIGPLAN Workshop on Higher-Order Programming with Effects. HOPE '12. ACM.
Pierce, B. C. (2002) Types and Programming Languages. MIT Press.
Reppy, J. H. (1993) Concurrent ML: Design, application and semantics. In Proceedings of the Functional Programming, Concurrency, Simulation and Automated Reasoning: International Lecture Series 1991-1992, McMaster University, Hamilton, Ontario, Canada. Springer-Verlag.
Reppy, J. H. (1999) Concurrent Programming in ML. Cambridge University Press.
Sekiyama, T., Nishida, Y. & Igarashi, A. (2015) Manifest contracts for datatypes. In Proceedings of the 42nd Symposium on Principles of Programming Languages, POPL '15. ACM.
Shinnar, A. (2011) Safe and Effective Contracts. Technical Report, Harvard University.
Siek, J. G. & Taha, W. (2006) Gradual typing for functional languages. Scheme and Functional Programming Workshop.
Siek, J. G., Garcia, R. & Taha, W. (2009) Exploring the design space of higher-order casts. In Proceedings of the European Symposium on Programming, ESOP '09. Springer-Verlag.
Strickland, T. S., Tobin-Hochstadt, S., Findler, R. B. & Flatt, M. (2012) Chaperones and impersonators: Run-time support for reasonable interposition. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA '12. ACM.
Swords, C., Sabry, A. & Tobin-Hochstadt, S. (2015) Expressing contract monitors as patterns of communication. In Proceedings of the 20th International Conference on Functional Programming, ICFP '15. ACM.
Vitousek, M. M., Siek, J. G., Kent, A. & Baker, J. (2014) Design and evaluation of gradual typing for Python. In Proceedings of the Dynamic Languages Symposium, DLS '14.
Wadler, P. & Findler, R. B. (2009) Well-typed programs can't be blamed. In Proceedings of the 18th European Symposium on Programming Languages and Systems. ESOP '09. Springer-Verlag.
Xu, D. N., Peyton Jones, S. & Claessen, K. (2009) Static contract checking for haskell. In Proceedings of the 36th Annual Symposium on Principles of Programming Languages, POPL '09. ACM.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Altmetric attention score

Full text views

Total number of HTML views: 0
Total number of PDF views: 142 *
Loading metrics...

Abstract views

Total abstract views: 317 *
Loading metrics...

* Views captured on Cambridge Core between 7th March 2018 - 17th July 2018. This data will be updated every 24 hours.

An extended account of contract monitoring strategies as patterns of communication

  • CAMERON SWORDS (a1), AMR SABRY (a1) and SAM TOBIN-HOCHSTADT (a1)
Submit a response

Discussions

No Discussions have been published for this article.

×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *