sdboyer / gogl

A graph library in Go
MIT License
77 stars 13 forks source link

Seek a way around constantly flip-flopping interfaces #6

Closed sdboyer closed 10 years ago

sdboyer commented 10 years ago

the way gogl is written right now, each graph implements a handful of interfaces. keeping track of this in client code is kinda crazy, and just about destroys the idea behind interfaces: to abstract implementation details away. when there are no unified interfaces, it effectively means that client code has to know which graph they're working with, and which interfaces they can switch it to. bleh.

the idiomatic Go answer is to export the struct, and have that be the primary thing that's passed around, except in cases where it a single, more specific interface is genuinely all that's needed. that may be the way to go (though it kinda runs counter to #1), and would definitely result in a giant explosion of godoc.

sdboyer commented 10 years ago

basically...either the struct has to be exposed, or a unique interface has to be composed for each one. kinda six one half dozen the other.

sdboyer commented 10 years ago

pinging @technosophos and @mattfarina for their input on this

sdboyer commented 10 years ago

ok, it's pretty clear that the best solution here is to export the structs. the only real argument against that is 'noise' in the godoc; all the other arguments are in favor of it.

mattfarina commented 10 years ago

I was thinking the same thing. I gave it a day and still came to the same conclusion.

sdboyer commented 10 years ago

excellent - now it's just a SMOP before declaring VICTORY