![Page 1: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/1.jpg)
A type language for message passingcomponent-based systems
Zorica Savanovic1, Hugo Vieira2 and Letterio Galletta1
ICE 2020, June 19, 2020
1IMT School for Advanced Studies, Lucca, Italy2University of Beira Interior, Portugal
![Page 2: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/2.jpg)
Introduction
I Code reusability is a key principle in Component-BasedDevelopment (CBD).1
I Solutions for code reuse in distributed software systems are lacking.
I A component should be able to carry out a certain sequence ofinput/output actions in order to fulfil its role in the protocol.
Too strict.I Components respond to an external stimulus.
Too wild.I Carbone, Montesi and Vieira 2 proposed a language (Governed
components language): merging reactive components withchoreographic specifications of communication protocols 3.
I Our contribution is at the level of the type language that allows tocapture component’s behaviour so as to check its compatibility witha protocol.
I Once the component’s type is identified, there is no further need tocheck the implementation.
1M. D. Mcllroy. Mass produced software components. In Software Engineering: Report of a conferencesponsored by the NATO Science Committee, pages 138–155. Garmisch, 1969.
2M. Carbone, F. Montesi, and H. T. Vieira. Choreographies for reactive programming. CoRR, abs/1801.08107,2018.
3F. Montesi. Choreographic Programming. PhD thesis, IT University of Copenhagen, 2013.
Zorica Savanovic 1/12
![Page 3: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/3.jpg)
Image Recognition System
Zorica Savanovic 2/12
![Page 4: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/4.jpg)
Base Components
Base component KPortal
PortalI fu(xp) = image, fr (x ′p) = class and
f ( ) = version
I Received images/classes are pro-cessed in a FIFO discipline
I f ( ) can always perform an output re-gardless of inputs
Zorica Savanovic 3/12
![Page 5: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/5.jpg)
“One-shot” protocol G
Zorica Savanovic 4/12
![Page 6: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/6.jpg)
Recursive protocol G
Zorica Savanovic 5/12
![Page 7: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/7.jpg)
The Type language syntax
I Two type extraction procedures:
I For base components
I For composite components
I Interfacing componentI Local protocol (projection of a global protocol)
Zorica Savanovic 6/12
![Page 8: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/8.jpg)
The type of KIRS , G “one-shot”
TIRS =< x(image); y(class) : 1 : [x : Ω], y ′(version) :∞ : [∅] >
Zorica Savanovic 7/12
![Page 9: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/9.jpg)
Type of KIRS , G recursive protocol
< x(image); y(class) :∞ : [x :0], y ′(version) :∞ : [∅] >
I Input two values on port x
I < x(image); y(class) :∞ : [x :2], y ′(version) :∞ : [∅] >I Output from port y one value
I < x(image); y(class) :∞ : [x :1], y ′(version) :∞ : [∅] >I CAN DO: y ′!.x?.y !.x?.y !.x?
I CANNOT DO: x?.y !.y !.x?.x?.y ′! (dependency)
Zorica Savanovic 8/12
![Page 10: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/10.jpg)
Type of KIRS , G recursive protocol
< x(image); y(class) :∞ : [x :0], y ′(version) :∞ : [∅] >
I Input two values on port x
I < x(image); y(class) :∞ : [x :2], y ′(version) :∞ : [∅] >
I Output from port y one value
I < x(image); y(class) :∞ : [x :1], y ′(version) :∞ : [∅] >I CAN DO: y ′!.x?.y !.x?.y !.x?
I CANNOT DO: x?.y !.y !.x?.x?.y ′! (dependency)
Zorica Savanovic 8/12
![Page 11: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/11.jpg)
Type of KIRS , G recursive protocol
< x(image); y(class) :∞ : [x :0], y ′(version) :∞ : [∅] >
I Input two values on port x
I < x(image); y(class) :∞ : [x :2], y ′(version) :∞ : [∅] >I Output from port y one value
I < x(image); y(class) :∞ : [x :1], y ′(version) :∞ : [∅] >I CAN DO: y ′!.x?.y !.x?.y !.x?
I CANNOT DO: x?.y !.y !.x?.x?.y ′! (dependency)
Zorica Savanovic 8/12
![Page 12: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/12.jpg)
Type of KIRS , G recursive protocol
< x(image); y(class) :∞ : [x :0], y ′(version) :∞ : [∅] >
I Input two values on port x
I < x(image); y(class) :∞ : [x :2], y ′(version) :∞ : [∅] >I Output from port y one value
I < x(image); y(class) :∞ : [x :1], y ′(version) :∞ : [∅] >
I CAN DO: y ′!.x?.y !.x?.y !.x?
I CANNOT DO: x?.y !.y !.x?.x?.y ′! (dependency)
Zorica Savanovic 8/12
![Page 13: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/13.jpg)
Type of KIRS , G recursive protocol
< x(image); y(class) :∞ : [x :0], y ′(version) :∞ : [∅] >
I Input two values on port x
I < x(image); y(class) :∞ : [x :2], y ′(version) :∞ : [∅] >I Output from port y one value
I < x(image); y(class) :∞ : [x :1], y ′(version) :∞ : [∅] >I CAN DO: y ′!.x?.y !.x?.y !.x?
I CANNOT DO: x?.y !.y !.x?.x?.y ′! (dependency)
Zorica Savanovic 8/12
![Page 14: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/14.jpg)
Main Results
Theorem (Subject Reduction)
If K ⇓ T and Kλ(v)−−→ K ′ and v has type b then T
λ(b)−−→ T ′ and K ′ ⇓ T ′.
Theorem (Progress)
If K ⇓ T and Tλ(b)−−→ T ′ and λ(b) 6= τ then b is the type of a value v
and Kλ(v)==⇒ K ′ and K ′ ⇓ T ′.
Kλ(v)==⇒ K ′ denotes a sequence of transitions
Kτ−→ · · ·K ′′ λ(v)−−→ K ′′′ τ−→ · · ·K ′.
Zorica Savanovic 9/12
![Page 15: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/15.jpg)
Difference with respect to related approaches
I The approach proposed by Carbone, Montesi and Vieira 4: weconsider a different approach, avoiding the implementation checkeach time a component is to be used.
I Open Multiparty Sessions 5: our components are potentially morereusable considering the I/O flexibility provided the reactive flavour;
I CHOReVOLUTION project6: our type-based approach that aims atabstracting from the implementation and providing more generalsupport for component substitution and reuse.
I FACTum7: do not provide any means to automatically extract typesfrom given components.
4M. Carbone, F. Montesi, and H. T. Vieira. Choreographies for reactive programming. CoRR, abs/1801.08107,2018.
5F. Barbanera and M. Dezani-Ciancaglini. Open multiparty sessions.6CHOReVOLUTION project. http://www.chorevolution.eu.7Marmsoler Diego, and Habtom Kashay Gidey. ”Interactive verification of architectural design patterns in
FACTum.” Formal Aspects of Computing 31.5 (2019): 541-610.
Zorica Savanovic 10/12
![Page 16: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/16.jpg)
Concluding Remarks
I We introduce a type language for the choice-free subset of the GClanguage
I Type language (syntax)
I We do static typing: inspecting the source code so as to avoidruntime errors.
I Subject reduction and Progress
I Typing descriptions such as ours are crucial to promote componentreusability
I Support for protocols with branching;
I Subtyping;
I Conveying the theoretical model to concrete applications.
Zorica Savanovic 11/12
![Page 17: A type language for message passing component …...Choreographies for reactive programming. CoRR, abs/1801.08107, 2018. 3F. Montesi. Choreographic Programming. PhD thesis, IT University](https://reader033.vdocument.in/reader033/viewer/2022060406/5f0f61377e708231d443def2/html5/thumbnails/17.jpg)
Zorica Savanovic 12/12