找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 170|回复: 0

Perform actions in t

[复制链接]

1

主题

0

回帖

5

积分

新手上路

积分
5
发表于 2023-12-21 04:47:23 | 显示全部楼层 |阅读模式
Mediator design pattern diagram The class Mediatorimplements a method sendthat accepts a message from a user and then forwards it to another user. Each user has a method receivefor receiving messages. I've also seen a two method approach. These can be for example methods commandand query. The main idea was to create dedicated methods for sending queries and commands in the system.

The purpose of the commands was tohe system. In turn the purpose of queries was to return results. This approach to the topic may be a good introduction to the implementation of the CQRS pattern in the system Phone Number List being built. Of course nothing prevents both inquiries and commands from being handled by the mediator using one method. Mediator – advantages and disadvantages Using Mediator brings several benefits.

4b6327_b4c6ae12ac534e048c9361cc1c4a573f~mv2.png



First a separate component dedicated to communication helps you write code that complies with the Single Responsibility Principle . The second significant advantage is the reduction of coupling between classes. Objects that communicate with each other do not need to know anything about each other. A small number of dependencies also allows you to easily expand the system with new objects.

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|芝加哥华人服务中心

GMT-5, 2024-11-17 15:44 , Processed in 0.079812 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表