wtf/crud: DialService instead of wtf.Dialer #14
-
|
https://www.gobeyond.dev/crud/ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The Naming the service as Ultimately it comes down to what works for me in practice. "Service" is generic enough that I don't need to think about what to name the CRUD interface but it's clear that it handles an entity. |
Beta Was this translation helpful? Give feedback.
The
-ersuffix works well for simple interfaces likeio.Reader&io.Writer(or evenio.ReadCloser). One option is to break up the interface into smaller interfaces likeDialFinder,DialCreator,DialUpdater, &DialDeleter. However, I've found that you end up with a lot of tiny interfaces without much benefit.Naming the service as
Dialeris an option but that would imply that there's aDial()function. That's the case withnet.Dialer(although that's not an interface).Ultimately it comes down to what works for me in practice. "Service" is generic enough that I don't need to think about what to name the CRUD interface but it's clear that it handles an entity.