-
Notifications
You must be signed in to change notification settings - Fork 53
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
Replace CID class with a CID interface #96
Comments
How deep do we go with this, though? Should we also ship |
They are interfaces already they just happen to live in the same repo. I think it would make sense to move interfaces into separate repo because:
That said I do not want to overcomplicate things too much. For this specific issue my plan was to just define CID as an interface similar to We can always move things between repos and package names if needed.
Generally speaking I think coding against implementations is a bad practice as it introduces incidental coupling. I find approach of specificity external dependencies through interfaces to work much better as they allow alternative implementations to be used. It also enables case specific optimized version to be introduced and dropped in without added coordination overhead. |
Most of ipfs / libp2p stack depends on CID class which introduces large number of dependencies, it is made worth by the fact that typescript forces all of them to agree on the same exact package to type check.
We should instead introduce CID interface and type our APIs so they take / produce value compatible with that interface. That way they become implementation agnostic allowing us to swap / upgrade implementation without coordinating these changes across the board.
CID Implementation in this library will just become a an implementation of that interface.
The text was updated successfully, but these errors were encountered: