Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: 重构添加好友逻辑 #17

Open
BanTanger opened this issue Mar 31, 2023 · 1 comment
Open

[feature]: 重构添加好友逻辑 #17

BanTanger opened this issue Mar 31, 2023 · 1 comment
Labels
feature 新增功能 good design 好的设计

Comments

@BanTanger
Copy link
Owner

预期功能描述

目前添加好友逻辑紧耦合,如果后期对用户状态有新的定义,就会引发 if - else 灾难,建议使用设计模式来优化这段逻辑

完成该预期功能所需要知识(可选)

考虑使用的设计模式

  1. 工厂模式
  2. 单例模式:保证只有一个数据库连接对象,避免创建重复对象导致内存庞大
  3. 状态模式:好友关系的判断其实是状态的判断,每一个 if - else 都可以做一个单独的类来封装

补充说明(可选)

@BanTanger BanTanger added feature 新增功能 good design 好的设计 labels Mar 31, 2023
@cmgyqjj
Copy link

cmgyqjj commented Oct 1, 2024

Hello, can you assign me this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 新增功能 good design 好的设计
Projects
None yet
Development

No branches or pull requests

2 participants