gpt4 book ai didi

oop - 为什么代理商和经理被认为是糟糕的 O-O 设计

转载 作者:行者123 更新时间:2023-12-04 14:31:45 25 4
gpt4 key购买 nike

早在 90 年代初,我就参与了一个系统的设计和实现,该系统包括许多“代理”类。该系统运行良好,并且具有合理的可维护性。现在,我在一个新的工作环境中与那些声称“对象应该是名词”的人争论不休。有没有很好的文章来解释为什么代理是个坏主意?以及更详细地将代理与对象区分开来的是什么(我明白了一般的想法,但具体是什么被弃用了?)

最好不是整本书:我刚刚开始阅读 Bertrand Meyer 的关于面向对象软件构建的书,这需要一些时间来完成。

根据 Tomasz 和 Niko 的评论,我更改了主题行(从要求指向文章的指针),现在邀请人们直接回答而不是提供指向文章的指针。

最佳答案

维基百科说

Agent-oriented programming (AOP) is a programming paradigm where the construction of the software is centered around the concept of software agents. In contrast to object-oriented programming which has objects (providing methods with variable parameters) at its core (http://en.wikipedia.org/wiki/Active_object)



然而,我不认为在 AOP 与 OOP 分开,我个人与 JADE( http://jade.tilab.com/ ,这是实现 FIPA 标准的最著名的框架之一( http://www.fipa.org ),据我所知,在 JADE 代理可以拥有可以利用来执行复杂功能的对象(作为java类的实例)。从这个意义上说,代理的概念类似于事件对象的概念(http://en.wikipedia.org/wiki/Active_object)。主要区别是代理在黄页注册表中发布他们提供的服务的描述,并且能够通过共享语言(可能基于本体)进行通信。还可以提供移动性,以便正在运行的代理可以迁移到不同的设备保留它的执行状态。然而,这种复杂性可以在线程的顶部实现,从而扩展 OO 范式而不是与之形成对比。

1990 年,Yoav Shoham 在他的人工智能研究中首次使用了代理的概念。

在此链接 http://www.infor.uva.es/~cllamas/MAS/AOP-Shoham.pdf你可以找到他说的 Shoham 出版物的摘录

whereas OOP proposes viewing a computational system as made up of modules that are able to communicate with one another and that have individual ways of handling incoming messages, AOP specializes the framework by fixing the state (now called mental state) of the modules (now called agents) to consist of precisely defined components called beliefs (including beliefs about the world, about rhemselves, and abour one anorher), capabiliries, choices, and possibly orher similar norions. A compurarion consists of rhese agents' informing, requesting, offering, accepting, rejecting, competing, and assisting one another. This idea is borrowed directly from the speech act literature (Grice 1989; Searle 1969;Austin 1962).



关键词是AOP 专业 面向对象框架。因此,正如我所说,它扩展了 OOP(尽管不一定以一种好的方式)。我猜您可能想使用这种架构,当您处理可能需要扩展以应对高度可变的任务的计算密集型系统时,这种架构的设计和实现非常好。在其他情况下,AOP 可能会过度杀伤,但这取决于您的设计师/架构师的敏感性。

关于oop - 为什么代理商和经理被认为是糟糕的 O-O 设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12114752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com