All in all, in most cases, we shouldn’t return interfaces but concrete implementa-tions. Otherwise, it can make our design more complex due to package dependencies and can restrict flexibility because all the clients would have to rely on the same abstraction. Again, the conclusion is similar to the previous sections: if we know (not foresee) that an abstraction will be helpful for clients, we can consider returning an interface. Otherwise, we shouldn’t force abstractions; they should be discovered by clients. If a client needs to abstract an implementation for whatever reason, it can still do that on the client’s side.
标签:abstraction,Returning,interfaces,clients,shouldn,mistakes,Go,100 From: https://www.cnblogs.com/zhangzhihui/p/18014630