是“信号和时隙”吗?反应式编程的概念?

发布于 2024-12-06 17:15:48 字数 38 浏览 0 评论 0 原文

正如标题中所写 - “信号和槽”是一种简单的反应式编程方法吗?

As written in the title - is "Signals and Slots" a simple way of reactive programming?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初见你 2024-12-13 17:15:48

Signals/Slots观察者模式

来自 响应式编程 上的 wiki:

反应式编程与面向对象编程中常用的观察者模式有主要相似之处。然而,将数据流概念集成到编程语言中将使它们更容易表达,因此可以增加数据流图的粒度。例如,观察者模式通常描述整个对象/类之间的数据流,而面向对象的反应式编程可以针对对象/类的成员。

他们使用了响应式编程维基中的 Excel 单元格/公式的示例,这无疑是使用 Excel 源代码中的观察者模式来实现的,以使其真正实现。然而,对于“excel 程序员”来说,它是响应式编程,因为他们不必自己实现观察者模式……所以在这个层面上它是有意义的。 C++/C#/C/etc 没有内置此功能。

Signals/Slots is an implementation of the Observer Pattern .

From the wiki on Reactive Programming:

Reactive programming has principal similarities with the Observer pattern commonly used in object-oriented programming. However, integrating the data flow concepts into the programming language would make it easier to express them, and could therefore increase the granularity of the data flow graph. For example, the observer pattern commonly describes data-flows between whole objects/classes, whereas object-oriented reactive programming could target the members of objects/classes.

They use the example of Excel cells / formulas in the Reactive Programming wiki, which is undoubtedly implemented using the observer pattern under the covers in the excel source code to make it actually happen. However, to the "excel programmer", it's Reactive Programming as they aren't having to implement the Observer Pattern themselves ... so it makes sense on that level. C++/C#/C/etc do not have this ability built in.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文