6

提一个严肃的问题,service层到底有没必要写接口层

 3 years ago
source link: https://www.oschina.net/question/2652412_2323397
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

提一个严肃的问题,service层到底有没必要写接口层

sprouting 发布于 今天 09:39
阅读 162

似乎从一开始接触,好像就有一个不成文的规定,service层往往要写一个 接口,然后在写一个实现层,通俗的说法是为了日后的扩展。

up-587a8fe2f2e9f8f695094c9b6330962b303.png

但写的久了,确实有一个疑惑,这一层到底有没必要?(我们只讨论普通的、常见的场景)从工作的这么多年来看,这一层确实没太大作用,一般用到接口的场景,是我定义某些规则,然后通过接口获取数据,不需要管实现才需要用到接口,而一般的项目,似乎根本没有太大的用处。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK