We present Choral, the first choreographic programming language based on mainstream abstractions. The key idea in Choral is a new notion of data type, which allows for expressing that data is distributed over different roles. We use this idea to reconstruct the paradigm of choreographic programming through object-oriented abstractions. Choreographies are classes, and instances of choreographies are objects with states and behaviours implemented collaboratively by roles. Choral comes with a compiler that, given a choreography, generates an implementation for each of its roles. These implementations are libraries in pure Java, whose types are under the control of the Choral programmer. Developers can then modularly compose these libraries in their own programs, in order to participate correctly in choreographies. Choral is the first incarnation of choreographic programming offering such modularity, which finally connects more than a decade of research on the paradigm to practical software development. The integration of choreographic and object-oriented programming yields other powerful advantages, where the features of one paradigm benefit the other in ways that go beyond the sum of the parts. The high-level abstractions and static checks from the world of choreographies can be used to write concurrent and distributed object-oriented software more concisely and correctly. We obtain a much more expressive choreographic language from object-oriented abstractions than in previous work. For example, object passing makes Choral the first higher-order choreographic programming language, whereby choreographies can be parameterised over other choreographies without any need for central coordination. Together with subtyping and generics, this allows Choral to elegantly support user-defined communication mechanisms and middleware.
翻译:本文提出Choral,这是首个基于主流抽象概念的编排式编程语言。其核心思想在于一种新型数据类型概念,能够表达数据在不同角色间的分布式特性。我们利用这一思想,通过面向对象抽象重构了编排式编程范式:编排被表示为类,其实例则是状态与行为由多个角色协作实现的对象。Choral配备编译器,可针对给定编排为每个角色生成对应的实现代码,这些实现是纯Java编写的库,其类型受Choral程序员控制。开发者可将这些库模块化地集成到自有程序中,从而正确参与编排流程。Choral是首个支持此类模块化设计的编排式编程语言,该特性将十余年的编排范式研究与实际软件开发相联结。编排编程与面向对象编程的融合带来了超乎单一范式叠加的协同优势:编排世界中的高级抽象与静态检查技术,可更简洁精确地编写并发及分布式面向对象软件;而面向对象抽象则赋予编排语言前所未有的表达能力。例如,对象传递机制使Choral成为首个高阶编排式编程语言——编排可作为参数传递给其他编排,且无需中央协调。结合子类型与泛型机制,Choral优雅地支持了用户自定义通信协议与中间件。