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

callback如何处理呢 #2

Open
qingni opened this issue Sep 26, 2019 · 1 comment
Open

callback如何处理呢 #2

qingni opened this issue Sep 26, 2019 · 1 comment

Comments

@qingni
Copy link

qingni commented Sep 26, 2019

你好,作者,看了您写的框架,有几个问题咨询下您,望您有空回复下,谢谢!
1.请问下,对于需要回调callback的action,您是怎么处理的呢?
2.看了您写的框架,不是很清楚Router和service的关系?为什么需要字典保存service和serviceimpl的映射呢?还有写的demo里面,使用service时,import了service头文件,这如果是跨模块调用的话,不就耦合了吗? 可能理解的不对,还望指导下~

@qingni qingni changed the title callback callback如何处理呢 Sep 26, 2019
@RyanLeeLY
Copy link
Owner

RyanLeeLY commented Oct 11, 2019

  1. 可以把callback的block作为参数传入,但要注意内存管理。
  2. Router可以理解成封装了支持URL方式调用的service,为了更进一步解耦。import了service的头文件可以看做某种程度上的依赖,但是耦合程度很轻,因为头文件仅仅包含protocol的定义;另外在本人自己的实践中,我会在业务模块外添加一层来作为和壳工程粘合层,service一般仅仅存在于这个粘合层中,因此模块之间不会产生直接的依赖。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants