Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider an interface-only package? #25

Open
CameronBieganek opened this issue Oct 5, 2023 · 3 comments
Open

Consider an interface-only package? #25

CameronBieganek opened this issue Oct 5, 2023 · 3 comments
Labels
question Further information is requested

Comments

@CameronBieganek
Copy link

It seems like it would be convenient to have a package that defines only the AbstractGraph interface without providing any implementations, similar to how Tables.jl and DataAPI.jl work. That way packages that implement new graph types only need to depend on the interface package.

On the other hand, does the new package extensions feature reduce the need for separate interface packages? I haven't played around with package extensions yet, so I don't know the answer to that question.

@CameronBieganek
Copy link
Author

@gdalle Any thoughts on this?

@gdalle
Copy link
Member

gdalle commented Oct 13, 2023

I think it makes development harder to have two unregistered repos, so I would put it on the back burner for now (not that development is really active either ^^). However I kinda like the idea for the medium term when things are more fleshed out

@gdalle gdalle added the question Further information is requested label Oct 26, 2023
@cpfiffer
Copy link

We did a lot of work on an abstract interface package for MCMC over here, and my experience from that was that it is useful, albeit contentious, to have an interface only package. I personally liked the setup but interfaces can be extremely "sticky" and hard to iterate on once they are in place. Ime I would make this an interface-only package and then just let it grow out.

You may already know some of this but I'll stick it in here since I am not nearly as familiar with the graphs ecosystem as you all. Some conclusions from AbstractMCMC:

  • Don't make parts of the interface required. It's more work for people who might only want to implement pieces (Best formalism to define the interface #2). Basically, provide a fallback method that tells you to implement some particular method if and when it is invoked.
  • This package (GraphsBase.jl) should contain all abstract types anyone would ever want to inherit from, i.e. AbstractGraph, AbstractVertex or AbstractNode, AbstractEdge, etc. Everything here is good and should be moved over, though this error should contain (a) the type that was called and (b) the method that was invoked.
  • Start small and hack shit together, interfaces can be more flexible than you think.
  • Traits aren't particularly worth it IMO.
  • DO provide a way to identify which methods are not implemented and which are -- we didn't really do this in AbstractMCMC and it ended up being a pain for people. An instructional method like interfaceimplementation(x) or something should give you specific instructions on how to implement each method, provide links to docs, a list of omitted interface methods, etc.
  • Very very few interface methods should actually need to be extended. For example, most methods have fallbacks that can be built (sometimes inefficiently) from core methods that return some kind of iterable or count. edges, neighbors, getindex, setindex, etc. should be almost all of what anyone should need to implement (I think you already have this for the most part but I just wanted to state it).

Just some opinions, in no particular order and not particularly well formed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants