What does the interface look like currently?

On Monday, June 27, 2016 at 10:54:31 PM UTC+2, Tyler Compton wrote:
>
> Right now, I have a web server with an interface that defines methods for 
> every kind of database read/write operation my application has. 
>
Any example ?
 

> Unsurprisingly, it's pretty large for a Go interface at around 30 methods. 
> I originally did this because I wanted to be able to support multiple 
> implementations of my database layer, but now it's only so that I can mock 
> out this functionality for testing, which is still important to me.
>
> This works fine, but it doesn't /feel/ right, whatever that means. As the 
> proverb goes, "the bigger the interface, the weaker the abstraction." To be 
> fair, I'm not really going for a lot of abstraction here. The only objects 
> that should implement this interface would be geared very heavily towards 
> my needs. Maybe that's where I went wrong.
>
> Is there a more idiomatic way I could be doing this?
>

Interfaces are composable so you could probably make a slight refactor 
where you assemble methods by usage. It may help keep things clearer. 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to