Contract-Oriented Programming with Timed Session Types

Contract-oriented programming is a software engineering paradigm which proposes the use of behavioural contracts to discipline the interaction among software components. In a distributed setting, the various components of an application may be developed and run by untrustworthy parties, which could opportunistically diverge from the expected behaviour when they find it convenient. The use of contracts in this setting is essential: by binding the behaviour of each component to a contract, and by sanctioning contract violations, components are incentivized to behave in a correct and cooperative manner. This chapter is a step-by-step tutorial on programming contract-oriented distributed applications. The glue between components is a middleware which establishes sessions between services with compliant contracts, and monitors sessions to detect and punish violations. Contracts are formalised as timed session types, which describe timed communication protocols between two components at the endpoints of a session. We illustrate some basic primitives of contract-oriented programming: advertising contracts, performing contractual actions, and dealing with violations. We then show how to exploit these primitives to develop some small distributed applications.

[1]  Daniel Brand,et al.  On Communicating Finite-State Machines , 1983, JACM.

[2]  Vijay A. Saraswat,et al.  Concurrent constraint programming , 1989, POPL '90.

[3]  Kohei Honda,et al.  An Interaction-based Language and its Typing System , 1994, PARLE.

[4]  Rajeev Alur,et al.  A Theory of Timed Automata , 1994, Theor. Comput. Sci..

[5]  Vasco Thudichum Vasconcelos,et al.  Language Primitives and Type Discipline for Structured Communication-Based Programming Revisited: Two Systems for Higher-Order Session Communication , 1998, SecReT@ICALP.

[6]  Anne H. H. Ngu,et al.  QoS-aware middleware for Web services composition , 2004, IEEE Transactions on Software Engineering.

[7]  Mudhakar Srivatsa,et al.  TrustGuard: countering vulnerabilities in reputation management for decentralized overlay networks , 2005, WWW '05.

[8]  David S. Rosenblum,et al.  QoS-Aware Service Composition in Dino , 2007, Fifth European Conference on Web Services (ECOWS'07).

[9]  Danilo Ardagna,et al.  Adaptive Service Composition in Flexible Processes , 2007, IEEE Transactions on Software Engineering.

[10]  Maria Grazia Buscemi,et al.  Programming Languages and Systems, 16th European Symposium on Programming, ESOP 2007, Held as Part of the Joint European Conferences on Theory and Practics of Software, ETAPS 2007, Braga, Portugal, March 24 - April 1, 2007, Proceedings , 2007, European Symposium on Programming.

[11]  Tao Yu,et al.  Efficient algorithms for Web services selection with end-to-end QoS constraints , 2007, TWEB.

[12]  Multiparty asynchronous session types , 2008, POPL '08.

[13]  Cristina Nita-Rotaru,et al.  A survey of attack and defense techniques for reputation systems , 2009, CSUR.

[14]  Massimo Bartoletti,et al.  A Calculus of Contracting Processes , 2010, 2010 25th Annual IEEE Symposium on Logic in Computer Science.

[15]  Emilio Tuosto,et al.  Contract-Oriented Computing in CO2 , 2012, Sci. Ann. Comput. Sci..

[16]  Emilio Tuosto,et al.  On the realizability of contracts in dishonest systems , 2012, COORDINATION.

[17]  Emilio Tuosto,et al.  Honesty by Typing , 2013, FMOODS/FORTE.

[18]  Laura Bocchi,et al.  Timed Multiparty Session Types , 2014, CONCUR.

[19]  Elsevier Open Archive A Calculus of Mobile Processes, I , 2015 .

[20]  Laura Bocchi,et al.  Meeting Deadlines Together , 2015, CONCUR.

[21]  Emilio Tuosto,et al.  From Communicating Machines to Graphical Choreographies , 2015, POPL.

[22]  Massimo Bartoletti,et al.  A Contract-Oriented Middleware , 2015, FACS.

[23]  Massimo Bartoletti,et al.  Compliance and Subtyping in Timed Session Types , 2015, FORTE.

[24]  Massimo Bartoletti,et al.  Developing Honest Java Programs with Diogenes , 2016, FORTE.

[25]  Laura Bocchi,et al.  Timed runtime monitoring for multiparty conversations , 2017, Formal Aspects of Computing.

[26]  Emilio Tuosto,et al.  Contract-Oriented design of distributed applications: A tutorial , 2017 .

[27]  Verifiable abstractions for contract-oriented systems , 2017, J. Log. Algebraic Methods Program..