常见的 GUI 框架展示了哪些软件设计模式?
我已经成为一名 Python 程序员 7 年多了,并且使用 PyQt 进行设计已经 3 年多了……但我不是受过经典训练的计算机科学家。主要的。最近,我一直在学习 Go 并积极关注 Golang-nuts 讨论列表,其中充满了非常聪明的开发人员。从这个讨论组中,我看到了很多关于软件设计模式的参考,例如Observer、Reactor等。同样,因为我不是CS专业的,所以我从未真正学习过所有这些术语和理论,但这让我想知道..
Qt、wx、GTK 等常见 GUI 框架表现出哪些设计模式?
我感觉它是不同组件的模式的混合体,例如事件循环与信号/槽或绑定与键-价值观察等等。我很想听到关于这些软件模式如何映射到这些框架的传统组件的解释或概括。
作为这个问题的一个次要因素:是否有 GUI 框架尝试采用完全不同的模式方法来实现 GUI 解决方案? Cocoa/objective-c 是否使用与其他事件循环模式相同的事件循环模式?
更新
为了帮助缩小问题的焦点,并根据 @HDDimon 的回答,我主要想知道行为模式(通信):
http://en.wikipedia.org/wiki/Design_Patterns#Behavioral_patterns
I have been a python programmer 7+ years now, and been designing with PyQt for 3+ years... But I am not a classically trained Comp Sci. major. More recently I have been learning Go and been actively following the Golang-nuts discussion list which is filled with extremely intelligent developers. From this discussion group, I have seen many references to software design patterns, such as Observer, Reactor, etc. Again because I am not a CS major, I never really learned all of this terminology and theory, but it made me wonder...
What design patterns do common GUI frameworks like Qt, wx, GTK exhibit?
I have a feeling like its a mixture of patterns for different components, such as the event loop vs signal/slots or binding vs Key-value observing, and so on. I would love to hear an explanation or generalization about how these software patterns map to the traditional components of these frameworks.
As a bit of a secondary element to this question: Are there GUI frameworks that try and take a completely different pattern approach to a GUI solution? Does Cocoa/objective-c use the same event loop patterns as these others?
Update
To help narrow down the focus of my question, and based on the answer by @HDDimon, I am mainly wondering about Behavior Patterns (communication):
http://en.wikipedia.org/wiki/Design_Patterns#Behavioral_patterns
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
再会。我认为您可以在 Martin Fowler 文章 GUI 架构 中找到最佳答案。
来自这篇文章:
根据本文,用于划分任何类型组件的最佳模式类型是结构模式。
摘自“设计模式:可重用面向对象软件的元素”,作者:“四人帮” :埃里希·伽玛、理查德·赫尔姆、拉尔夫·约翰逊、约翰·弗利塞德斯。 (我真的很想推荐您阅读这本很棒的书)
但是在任何类型的框架中,您都可以看到多种类型模式的混合:创建模式、结构模式、行为模式。
我从设计模式书中找到了模式之间的关系图,它可能对日常使用有帮助。
UPD:很好,已添加答案。
Good day. I think the best answer you will find in Martin Fowler article GUI Architectures.
from this article:
According to this article, the best types of patterns for division between any kinds of components is Structural Patterns.
from "Design Patterns: Elements of Reusable Object-Oriented Software" by The "Gang of Four": Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. (I really want recommend you to read this awesome book)
But in any kind of frameworks you can see mix from several types of patterns: Creational patterns, Structural patterns, Behavioral patterns.
I had found a relational diagram between patterns from Design Patterns book, it may be helpful for everyday using.
UPD: Great SO answer added.