查看“︁响应式编程”︁的源代码
←
响应式编程
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{noteTA |G1=IT |1=编程;zh-hans:编程;zh-tw:程式設計; }} {{More footnotes|time=2020-05-02}} 在[[计算 (计算机科学)|计算]]中,'''响应式编程'''或'''反应式编程'''({{lang-en|Reactive programming}})是一种面向数据[[串流]]和变化传播的[[声明式编程|声明式]][[编程范式]]。这意味着可以在编程语言中很方便地表达静态或动态的数据流,而相关的计算模型会自动将变化的值通过数据流进行传播。 ==实例== 例如,在命令式编程环境中,<math>a := b + c </math>表示将表达式的结果赋给<math>a</math>,而之后改变<math>b</math>或<math>c</math>的值不会影响<math>a</math>。但在响应式编程中,<math>a</math>的值会随着<math>b</math>或<math>c</math>的更新而更新。电子表格程序就是响应式编程的一个例子。单元格可以包含字面值或类似"=B1+C1"的公式,而包含公式的单元格的值会依据其他单元格的值的变化而变化 。 另一个例子是[[硬件描述语言]],比如[[Verilog]],这里响应式编程可以对电路中传播的信号变化进行建模。 响应式编程最初是为了简化交互式用户界面的创建和实时系统动画的绘制而提出来的一种方法,但它本质上是一种通用的编程范式。 例如,在[[Model-view-controller|MVC软件架构]]中,响应式编程允许将相关模型的变化自动反映到视图上,反之亦然<ref name="refTrellis">{{Citation | url = http://peak.telecommunity.com/DevCenter/Trellis#model-view-controller-and-the-observer-pattern | title = Model-view-controller and the observer pattern | last = Trellis | publisher = Tele community | access-date = 2020-05-02 | archive-url = https://web.archive.org/web/20160303170619/http://peak.telecommunity.com/DevCenter/Trellis#model-view-controller-and-the-observer-pattern | archive-date = 2016-03-03 | dead-url = yes }}.</ref>。 ==范型== 响应式编程范型基于{{en-link|Edward A. Lee|}}和{{en-link|David G. Messerschmitt|David Messerschmitt}}在1987年提出的[[同步式编程|同步]][[数据流程编程|数据流程]][[编程范型]]<ref>{{cite web |url=https://ptolemy.berkeley.edu/publications/papers/87/synchdataflow/ |title=Synchronous Data Flow |access-date=2021-02-15 |archive-date=2020-08-04 |archive-url=https://web.archive.org/web/20200804201112/https://ptolemy.berkeley.edu/publications/papers/87/synchdataflow/ |dead-url=no }}</ref>,但是放松了实时限制。响应式编程范型介入了表示连续时变值的行为(behaviour),和表示离散值的事件。 ==概念== ===外显性的程度=== 响应式编程语言包括从显式的使用箭头来表示数据流,到隐式的通过语言类似命令式或者函数式的语言架构衍生而来的数据流。例如,在隐式的[[函数式响应式编程]]中,一个函数调用可能隐式的导致一个节点在数据流图中被创建出来。动态语言的响应式编程库(例如Lisp的“Cells”和Python的“Trellis”等)可以在运行时通过对函数执行数值读取的过程进行分析,构建出依赖图,使得数据流不仅隐式,而且动态。 响应式编程的说法有时候会被用在软件工程的架构分层中,这是数据流图中所谓的节点只是能够互相通信的普通程序。 ==参见== *[[函数式响应式编程]] ==引用== {{reflist}} == 外部链接 == * [http://soft.vub.ac.be/Publications/2012/vub-soft-tr-12-13.pdf A survey on reactive programming] {{Wayback|url=http://soft.vub.ac.be/Publications/2012/vub-soft-tr-12-13.pdf |date=20171209200513 }} A paper by E. Bainomugisha, A. Lombide Carreton, T. Van Cutsem, S. Mostinckx, and W. De Meuter that surveys and provides a taxonomy of existing reactive programming approaches. * [http://www-sop.inria.fr/mimosa/rp/generalPresentation/index.html MIMOSA Project of INRIA - ENSMP]{{Wayback|url=http://www-sop.inria.fr/mimosa/rp/generalPresentation/index.html |date=20160709041341 }}, a general site about reactive programming. {{编程范型}} [[Category:编程范式]]
该页面使用的模板:
Template:Citation
(
查看源代码
)
Template:Cite web
(
查看源代码
)
Template:En-link
(
查看源代码
)
Template:Lang-en
(
查看源代码
)
Template:More footnotes
(
查看源代码
)
Template:NoteTA
(
查看源代码
)
Template:Reflist
(
查看源代码
)
Template:Wayback
(
查看源代码
)
Template:编程范型
(
查看源代码
)
返回
响应式编程
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息