Pull-Stream模块的形式化描述及正确实现
A Formalization for Specifying and Implementing Correct Pull-Stream Modules
摘要:
Pull-stream是一种基于回调函数的JavaScript需求驱动的功能设计模式,支持创建和轻松组合用于创建流应用程序的独立模块。它被用于流行的开源项目,围绕它的社区已经创建了一百多个兼容模块。虽然拉流设计模式的描述看起来很简单,但它确实展示了复杂的终止情况。尽管拉流设计模式很流行,也很受欢迎,但没有现有的正式规范可以帮助程序员推断其实现的正确性。因此,本文的主要贡献是提供了一个形式化的指定和实现正确的拉流模块的基础上:(1)我们表明拉流设计模式是一种形式的声明式并发编程:(2)我们提出了一个基于事件的协议语言,支持我们的形式化,独立于JavaScript;(3)我们提供了在两个模块的接口处发生的事件的预期序列的第一个精确和明确的定义,我们称之为拉流协议;(4)我们指定了表现出拉流协议的全部行为范围的参考模块;(5)我们通过测试现有的核心拉流模块来验证我们的定义是否符合社区的期望,并识别现有模块中未指定的行为。我们的方法有助于更好地理解拉流协议,以确保社区模块的互操作性,并在论文和文档中简洁准确地指定新的拉流抽象。
英文摘要:
Pull-stream is a JavaScript demand-driven functional design pattern based on callback functions that enables the creation and easy composition of independent modules that are used to create streaming applications. It is used in popular open source projects and the community around it has created over a hundred compatible modules. While the description of the pull-stream design pattern may seem simple, it does exhibit complicated termination cases. Despite the popularity and large uptake of the pull-stream design pattern, there was no existing formal specification that could help programmers reason about the correctness of their implementations. Thus, the main contribution of this paper is to provide a formalization for specifying and implementing correct pull-stream modules based on the following: (1) we show the pull-stream design pattern is a form of declarative concurrent programming; (2) we present an event-based protocol language that supports our formalization, independently of JavaScript; (3) we provide the first precise and explicit definition of the expected sequences of events that happen at the interface of two modules, which we call the pull-stream protocol; (4) we specify reference modules that exhibit the full range of behaviors of the pull-stream protocol; (5) we validate our definitions against the community expectations by testing the existing core pull-stream modules against them and identify unspecified behaviors in existing modules. Our approach helps to better understand the pull-stream protocol, to ensure interoperability of community modules, and to concisely and precisely specify new pull-stream abstractions in papers and documentation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。