optimize: abstract backend process logic to service interface #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
这个PR解决什么问题?
pr主要是把后端的数据处理逻辑接口化、服务化,定义好需要的数据处理逻辑接口,按需要的场景实现对应的服务接口,然后通过统一的函数导出接口服务。
为什么要把后端数据处理逻辑服务接口化?
后端数据处理逻辑服务接口化的优缺点?
优点: 接口清晰、可扩展性好;
缺点: 代码编写有点繁琐,需要定义接口、编写实现、导出服务等。
总的来说,面向接口编程还是一种比较好的编程范式。