Models and Languages for Service-Oriented and Cloud Computing University of Bologna Gianluigi Zavattaro DISI - Department of Computer Science and Engineering INRIA research team FOCUS BISS 2016 – Bertinoro – 7-11 March 2016
A brief introduction … u Associate Professor at the University of Bologna , DISI – Computer Science and Engineering Department u My background: n Foundational aspects of programming languages n Concurrency theory u My recent interests (this course): n Rigorous investigation of basic concepts in emerging classes of languages for wide area programming Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
The Programmable Web The Web offers a continuosly growing number of services available through dedicated APIs Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
The Programmable Web Different kinds of APIs (with their corresponding protocols) exist … Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Service-Oriented Programming u … but in general, independently from the protocols/APIs, services call for: n Specific programming paradigms : w ORC : functional approach w Chor / Jolie : imperative approach n Specific programming concepts : w Behavioural interfaces, compliance, global behavioural specifications, conformance, … Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
ORC https://orc.csres.utexas.edu u Basic idea: n Apply the functional paradigm to service-oriented programming n Incorporate in the programming language the concept of service (as a special form of function, called site ) and … n ... define composition operators to program the so-called service orchestrations Jayadev Misra, William R. Cook: Computation Orchestration. Software and System Modeling 6(1): 83-110 (2007) Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC syntax Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC syntax Publishes 1 or no value Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
The site in ORC u The basic ORC expression is site call n A site is invoked , as a function, but it nondeterministically publishes either one value or never return any value w No value reflects, at the programming language level, the unreliability of services n Ex: BBC(d) either returns the BBC newspage for date d , or never returns Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC syntax Three main composition operators Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Composition operators in ORC u ORC expression can be combined … n … in parallel : CNN(d) | BBC(d) this expression can publish 0, 1 or 2 values n … in sequence : ( CNN(d) | BBC(d) ) > m > Email(“xxx@yyy”,m) each value published from the lhs activates the evaluation of the rhs (the published values are assigned to the variable m ) n … in asymmetric parallel (see next slide) Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Asymmetric parallel composition u Email(“xxx@yyy”,m) where m : ∈ ( CNN(d) | BBC(d) ) sends the email only relative to the first newspage published by the rhs (not both!) n The lhs and rhs start to be evaluated in parallel … n … but the evaluation of the subexpressions of the lhs that needs m are deferred until the first value is published, and assigned to m Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC syntax Expression definition Expression call Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Expression definition u Email(“xxx@yyy”,m) where m : ∈ ( CNN(d) | BBC(d) ) This expression can be rewritten as follows: TwoNews(d) Δ CNN(d) | BBC(d) Email(“xxx@yyy”,m) where m : ∈ TwoNews(d) n The defined expression can be used inside other expressions (by indicating actual parameters) w it is replaced by its definition, where formal parameters are replaced by the actual ones Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC semantics Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC semantics Asynchronous semantics: Call , Return , Publication are separated events ( let is a special site that simply publishes its arguments) Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC semantics Parallel composition Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC semantics Sequential composition Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC semantics Asymmetric parallel composition Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Formal definition of ORC semantics Expression definition evaluation Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Example Email(“xxx@yyy”,m) where m : ∈ ( CNN(d) | BBC(d) ) à Email(“xxx@yyy”,m) where m : ∈ ( ?u | BBC(d) ) à Email(“xxx@yyy”,m) where m : ∈ ( ?u | ?u’ ) à Email(“xxx@yyy”,m) where m : ∈ ( let(n) | ?u’ ) à Email(“xxx@yyy”,n) à ?u’’ à let(c) à 0 Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Pros and Cons of the asynchronous semantics Email(“xxx@yyy”,m) where m : ∈ let(n) | ComplexExpression u In “real life” the Email will consider n n instead of the first value published by a very complex expression (e.g., including hundreds of external service invocations) u For this reason ORC has been equipped also with a synchronous semantics u The idea is to postpone responses u?c (produced by the SiteRet rule) thus giving priority to local actions n The semantics is now divided in alternative rounds : local actions, one response, local actions, one response, …. n In this way, if ComplexExpression requires at least one site call, let(n) is guaranteed to publish first (during first round) Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
ORC equivalences u What about 0 and 0 >x> f ? Are these expressions equivalent ? u What about ( g | h ) > x > f and ( g > x > f ) | ( h > x > f ) ? u What about f > x > ( g | h ) and ( f > x > g ) | ( f > x > h ) ? u What about ( f > y > g ) where x : ∈ h and ( f where x : ∈ h ) > y > g ? Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Bisimulation has been used to prove equivalence laws Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Bisimulation has been used to prove equivalence laws Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
The ORC language u What we have seen so far is named ORC calculus u A fully fledged language, called ORC, has been developed starting from the calculus u Few examples of programs follows n An ORC interpreter is available at: https://orc.csres.utexas.edu/tryorc.shtml Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Basic site calls u Println is a built-in site that prints a string (and then publishes a generic signal): Println ("Hello World") u Prompt is a built-in site that prompt the user to input a string, which is then published: Prompt ("What is your name ?") Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Basic composition operators u Parallel composition: Prompt ("Red or black ?") | Prompt ("Odd or even ?") u Sequential composition: Prompt ("What is your name?") > x > Println ("Your name is " + x) u Asymmetric parallel composition: fruits < fruits < ( Prompt ("Apples or oranges?") | Prompt ("Grapes or mangos?") ) Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Ask two questions and use both answers ( Prompt ("Red or black ?") | Prompt ("Odd or even ?") ) > x > Println ("Your choice is " + x) Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Ask two questions and use both answers ( Prompt ("Red or black ?") | Prompt ("Odd or even ?") ) > x > Println ("Your choice is " + x) Modify it to use only the first answer Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Ask two questions and use both answers Println ("Your choice is " + x) < x < ( Prompt ("Red or black ?") | Prompt ("Odd or even ?") ) … here it is ... only the first answer! Models and Languages for Service-Oriented and Cloud Computing Bertinoro 7-11/3/2016
Recommend
More recommend